Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
ec02ef6
doc: remove stale NotInPreparePhase claim on get_nakamoto_reward_cycl…
May 14, 2026
32a0a42
doc: remove stale 'invalid slot' error claim on get_miner_slot
May 14, 2026
bccd1e3
doc: correct bind() comment to reflect panic-on-failure behavior
May 14, 2026
1bee65f
doc: correct LeaderBlockCommitOp::check return claim
May 14, 2026
c70db22
doc: correct increase_lock_v{2,3,4} panic/version claims
May 14, 2026
db4a2ff
doc: correct main_loop comment about run_one_pass return value
May 14, 2026
5480ee7
doc: correct make_block_commit return-on-failure claim
May 14, 2026
7225f7a
doc: correct canonical_repr_at_block to reflect enum STXBalance
May 14, 2026
4ade2f6
doc: get_block_processed_and_signed_weight does not filter on orphaned
May 14, 2026
296011b
doc: process_new_anchored_block returns BlockAcceptResponse not bool
May 14, 2026
cf9a580
doc: process_new_nakamoto_block_ext returns BlockAcceptResponse not bool
May 14, 2026
1d280f3
doc: preprocess_anchored_block refers to non-existent SortitionDB::ex…
May 14, 2026
2fd61cb
doc: as_block_rejection doc says 'block accept' but extracts rejection
May 14, 2026
367685f
doc: rotate_vrf_and_register doc claims bool return but function retu…
May 14, 2026
56ae04d
doc: process_new_nakamoto_block refers to non-existent inner_process_…
May 14, 2026
6a3354e
doc: total_signing_weight returns Result<u32, String> not ChainstateE…
May 14, 2026
3daae56
doc: MARF::seal returns Err on already-sealed, does not panic
May 14, 2026
78e26b9
doc: extend_trie returns Result<(), Error> not bool
May 14, 2026
ace0cc8
doc: from_parent_unsigned returns Option, not an error type
May 14, 2026
bcbd912
doc: process_block_ops returns tuple, doc claimed only BlockSnapshot
May 14, 2026
f42ae3d
doc: net/api new_get* helpers were copy-pasted from getinfo.rs
May 14, 2026
8bdc67c
tmp: pox v4 doc fix
May 14, 2026
00f9313
tmp: set_block_processed/orphaned attachable doc
May 14, 2026
ac0b013
tmp: get_nakamoto_blocks_in_tenure doc
May 14, 2026
98030d8
tmp: check_first_nakamoto_tenure_change
May 14, 2026
14a34bf
tmp: clarity special_get info doc fix
May 14, 2026
ccb370a
tmp: BlockAccepted struct doc
May 14, 2026
1fe56c0
tmp: MockProposal::new doc
May 14, 2026
0dfcdfd
tmp: BlockResponseData::new doc
May 14, 2026
13eba1b
tmp: pre_epoch_begin doc
May 14, 2026
00ba74d
tmp: build_anchored_block doc
May 14, 2026
dc64b3a
tmp: sign_next* docs
May 14, 2026
3152cfb
tmp: get_consensus_at doc
May 14, 2026
4f82321
tmp: get_coinbase_tx doc
May 14, 2026
84a1c1f
tmp: find_mature_miner_rewards doc
May 14, 2026
eb83c5a
tmp: get_nakamoto_block_status doc
May 14, 2026
f3018b4
tmp: pox-locking pox4 docs
May 14, 2026
8ed4c8c
tmp: send_next_download_request doc
May 14, 2026
a39bf4b
tmp: ReplayScopeOpt doc
May 14, 2026
c7b8dd3
tmp: make_min_median_distribution doc user-burns
May 14, 2026
0fd89f5
tmp: capitulate_miner_view doc local_address
May 14, 2026
b2af061
tmp: ATC_LOOKUP doc above->below
May 14, 2026
30fdb70
tmp: put_data_with_size doc
May 14, 2026
0c58133
tmp: NakamotoBlockBuilder::new doc params
May 14, 2026
df74668
tmp: check_shadow_coinbase_tx doc
May 14, 2026
91908ac
tmp: shadow_load_tenure_info doc
May 14, 2026
2249d68
tmp: validate_shadow_against_burnchain doc burn_tip
May 14, 2026
f6229e7
tmp: get_shadow_vrf_proof doc
May 14, 2026
ec796f0
tmp: get_matured_miner_reward_schedules doc
May 14, 2026
e93e96e
tmp: PREAMBLE_ENCODED_SIZE doc fields above
May 14, 2026
35a1832
tmp: BlockMetadata.tenure_size doc
May 14, 2026
7c4fc08
tmp: MerkleTree::path empty-tree doc
May 14, 2026
c6aa36c
tmp: check_valid_consensus_hash doc
May 14, 2026
908515b
tmp: handle_insert_block_error doc
May 14, 2026
f4c57a1
tmp: SignerDb::new doc
May 14, 2026
671be3f
tmp: is_preamble_valid doc
May 14, 2026
1aa04cc
tmp: highest_reward_cycle doc
May 14, 2026
613369b
tmp: make_chunk_request_schedule doc
May 14, 2026
1a30db1
tmp: update_from_handshake_data doc
May 14, 2026
5442f0e
tmp: process_getnakamotoinv_finishes doc
May 14, 2026
63cf74a
tmp: insert_block doc broadcast column
May 14, 2026
0f65f1c
tmp: commit_metadata_for_trie doc drop sibling fn name
May 14, 2026
c4b0d18
tmp: handle_signer_stackerdb_update doc reward_cycle
May 14, 2026
11515b6
stale-comment: address_testnet doc says mainnet
May 14, 2026
e153163
stale-comment: try_replace_chunk doc lists only StaleChunk
May 15, 2026
507a0ec
stale-comment: finished_tenure_consensus_hash maps to bool not block ID
May 15, 2026
40aaed6
stale-comment: get_nakamoto_tenure_length doc misrepresents return value
May 15, 2026
4440f83
stale-comment: decode_http_request doc says tuple, returns struct
May 15, 2026
dde9968
stale-comment: make_next_download_request doc lists nonexistent Ok(None)
May 15, 2026
189911a
stale-comment: get_current_burnchain_block_height doc only describes …
May 15, 2026
0fa6a45
stale-comment: walk_peer_graph doc reverses tuple order
May 15, 2026
332717f
stale-comment: get_db_version_from_path doc says string; returns u32
May 15, 2026
606fd06
stale-comment: SignerEntries::parse doc names nonexistent type Nakamo…
May 15, 2026
986db08
stale-comment: store_burnchain_db_entry doc claims row ID; returns ()
May 15, 2026
6cf8bd7
stale-comment: SortitionHash::initial doc describes mix_burn_header
May 15, 2026
a787bff
stale-comment: finish_block doc omits SIP-031 event from FinishBlockE…
May 15, 2026
2d8cd76
stale-comment: get_block_cost doc says 'of block' but queries total_t…
May 15, 2026
f2c8dd8
stale-comment: get_tx_info_from_txid doc lists 2 of 3 returned values
May 15, 2026
c398e58
stale-comment: decode_http_response doc has tuple order reversed
May 15, 2026
116c9ac
stale-comment: add_block_rejection_signer_addr doc says signature
May 15, 2026
a16d8f7
stale-comment: append_block doc omits Option<RewardSetData>
May 15, 2026
2b469ad
doc: BlockProposalData::new mentions miner_diagnostic_data, not unkno…
May 15, 2026
e3e6004
doc: handle_comms_epoch2 takes bits, not comms
May 15, 2026
b96f3e9
doc: handle_new_nakamoto_stacks_block always returns Ok(None) on success
May 15, 2026
ea61e06
doc: handle_pox_cycle_start_pox_4 is a no-op
May 15, 2026
5da221d
doc: relay_epoch3_blocks uses recently_sent map, not force_send param
May 15, 2026
a9513c2
doc: effective_unlock_height mentions PoX 4 early unlock for PoX 3
May 15, 2026
938e0f9
doc: tx_busy_handler never panics; describes actual behaviour
May 15, 2026
3099778
doc: inner_execute_contract refers to ExecutionState, not Environment
May 15, 2026
d7c9278
quality: 018 process-stx-unlocks-tuple-doc
May 15, 2026
4f9fbd7
quality: 019 setup-block-doc-omits-six-fields
May 15, 2026
1eacc6e
quality: 020 process-microblocks-transactions-doc-omits-receipts
May 15, 2026
d37b6ab
quality: 021 process-block-transactions-doc-omits-receipts
May 15, 2026
844c4ff
doc: fix burn-block-info property identifiers in special_get_burn_blo…
May 15, 2026
954d7bd
fix doc comment for EarlyReturnError::UnwrapFailed
May 15, 2026
e48e2eb
fix LruCache::flush doc to match flattened Result type
May 15, 2026
21d6bf0
fix get_reward_set doc to match return type
May 15, 2026
3bffda1
fix verify_signer_signatures doc to include NoRegisteredSigners
May 15, 2026
520c394
fix get_read_count_extend_timestamp doc: copy-paste from tenure-extend
May 15, 2026
39b45c6
fix check_burnchain_config_changed doc: actual return tuple, uncondit…
May 15, 2026
5789dd3
docs: pox-locking pox_lock_extend/increase docs use LockingError, not…
May 15, 2026
fe029dd
docs: static_check_problematic_relayed_tx returns Result<(), Error>, …
May 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clarity/src/vm/contexts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ impl<'a, 'b, 'hooks> ExecutionState<'a, 'b, 'hooks> {
/// `allow_private` should always be set to `false` for user transactions:
/// this ensures that only `define-public` and `define-read-only` methods can
/// be invoked. The `allow_private` mode should only be used by
/// `Environment::execute_contract_allow_private`.
/// `ExecutionState::execute_contract_allow_private`.
fn inner_execute_contract(
&mut self,
invoke_ctx: &InvocationContext,
Expand Down
14 changes: 9 additions & 5 deletions clarity/src/vm/database/clarity_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ impl<'a> ClarityDatabase<'a> {
self.store.put_data(key, &value.serialize())
}

/// Like `put()`, but returns the serialized byte size of the stored value
/// Like `put_data()`, but returns the serialized byte size of the stored value
pub fn put_data_with_size<T: ClaritySerializable>(
&mut self,
key: &str,
Expand Down Expand Up @@ -1102,10 +1102,14 @@ impl ClarityDatabase<'_> {
}

/// Get the last-known burnchain block height.
/// Note that this is _not_ the burnchain height in which this block was mined!
/// This is the burnchain block height of the parent of the Stacks block at the current Stacks
/// block height (i.e. that returned by `get_index_block_header_hash` for
/// `get_current_block_height`).
///
/// Behavior depends on the active Clarity epoch:
/// * Before epoch 3.0, this is the burnchain block height of the parent of the Stacks block
/// at the current Stacks block height (i.e. that returned by `get_index_block_header_hash`
/// for `get_current_block_height`) — note this is _not_ the burnchain height in which this
/// block was mined.
/// * In epoch 3.0+, this is the current burnchain tip height (queried directly via
/// `BurnStateDB::get_tip_burn_block_height`).
pub fn get_current_burnchain_block_height(&mut self) -> Result<u32, VmExecutionError> {
let cur_stacks_height = self.store.get_current_block_height();

Expand Down
19 changes: 10 additions & 9 deletions clarity/src/vm/database/structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ impl<'db, 'conn> STXBalanceSnapshot<'db, 'conn> {
}

/// Increase the account's current lock to `new_total_locked`.
/// Panics if `self` was not locked by V2 PoX.
/// Returns Err(VmInternalError::Expect) if `self` was not locked by V2 PoX.
pub fn increase_lock_v2(&mut self, new_total_locked: u128) -> Result<(), VmExecutionError> {
let unlocked = self.unlock_available_tokens_if_any()?;
if unlocked > 0 {
Expand Down Expand Up @@ -763,7 +763,7 @@ impl<'db, 'conn> STXBalanceSnapshot<'db, 'conn> {
}

/// Increase the account's current lock to `new_total_locked`.
/// Panics if `self` was not locked by V3 PoX.
/// Returns Err(VmInternalError::Expect) if `self` was not locked by V3 PoX.
pub fn increase_lock_v3(&mut self, new_total_locked: u128) -> Result<(), VmExecutionError> {
let unlocked = self.unlock_available_tokens_if_any()?;
if unlocked > 0 {
Expand Down Expand Up @@ -863,7 +863,7 @@ impl<'db, 'conn> STXBalanceSnapshot<'db, 'conn> {

/// Extend this account's current lock to `unlock_burn_height`.
/// After calling, this method will set the balance to a "LockedPoxFour" balance,
/// because this method is only invoked as a result of PoX3 interactions
/// because this method is only invoked as a result of PoX4 interactions
pub fn extend_lock_v4(&mut self, unlock_burn_height: u64) -> Result<(), VmExecutionError> {
let unlocked = self.unlock_available_tokens_if_any()?;
if unlocked > 0 {
Expand All @@ -889,7 +889,7 @@ impl<'db, 'conn> STXBalanceSnapshot<'db, 'conn> {
}

/// Increase the account's current lock to `new_total_locked`.
/// Panics if `self` was not locked by V3 PoX.
/// Panics if `self` was not locked by V4 PoX.
pub fn increase_lock_v4(&mut self, new_total_locked: u128) -> Result<(), VmExecutionError> {
let unlocked = self.unlock_available_tokens_if_any()?;
if unlocked > 0 {
Expand Down Expand Up @@ -929,7 +929,7 @@ impl<'db, 'conn> STXBalanceSnapshot<'db, 'conn> {
}

/// Return true iff `self` represents a snapshot that has a lock
/// created by PoX v3.
/// created by PoX v4.
pub fn is_v4_locked(&mut self) -> Result<bool, VmExecutionError> {
match self.canonical_balance_repr()? {
STXBalance::LockedPoxFour { .. } => Ok(true),
Expand Down Expand Up @@ -1036,7 +1036,8 @@ impl STXBalance {
}

/// This method returns the datastructure's lazy view of the unlock_height
/// *while* factoring in the PoX 2 early unlock for PoX 1 and PoX 3 early unlock for PoX 2.
/// *while* factoring in the PoX 2 early unlock for PoX 1, the PoX 3 early
/// unlock for PoX 2, and the PoX 4 early unlock for PoX 3.
/// This value is still lazy: this unlock height may be less than the current
/// burn block height, if so it will be updated in a canonicalized view.
pub fn effective_unlock_height(
Expand Down Expand Up @@ -1159,9 +1160,9 @@ impl STXBalance {
}

/// Returns a canonicalized STXBalance at a given burn_block_height
/// (i.e., if burn_block_height >= unlock_height, then return struct where
/// amount_unlocked = 0, unlock_height = 0), and the amount of tokens which
/// are "unlocked" by the canonicalization
/// (i.e., if burn_block_height >= unlock_height, then return
/// STXBalance::Unlocked { amount: total_balance }), and the amount of
/// tokens which are "unlocked" by the canonicalization.
pub fn canonical_repr_at_block(
&self,
burn_block_height: u64,
Expand Down
4 changes: 2 additions & 2 deletions clarity/src/vm/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ pub enum RuntimeError {
/// These errors halt evaluation and fail the transaction.
pub enum EarlyReturnError {
/// Failed to unwrap an `Optional` (`none`) or `Response` (`err` or `ok`) Clarity value.
/// The `Box<Value>` holds the original or thrown value. Triggered by `try!`, `unwrap-or`, or
/// `unwrap-err-or`.
/// The `Box<Value>` holds the original or thrown value. Triggered by `try!`, `unwrap!`, or
/// `unwrap-err!`.
UnwrapFailed(Box<Value>),
/// An 'asserts!' expression evaluated to false.
/// The `Box<Value>` holds the value provided as the second argument to `asserts!`.
Expand Down
16 changes: 8 additions & 8 deletions clarity/src/vm/functions/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ pub fn special_delete_entry_v205(
/// # Errors:
/// - [`RuntimeCheckErrorKind`] cost errors (e.g., `CostOverflow`, `CostBalanceExceeded`) from [`runtime_cost`].
/// - [`RuntimeCheckErrorKind::IncorrectArgumentCount`] if there aren't 2 arguments.
/// - [`RuntimeCheckErrorKind::GetBlockInfoExpectPropertyName`] if `args[0]` isn't a ClarityName or isn't a valid [`BlockInfoProperty`].
/// - [`RuntimeCheckErrorKind::Unreachable`] if `args[0]` isn't a ClarityName or isn't a valid [`BlockInfoProperty`] (the static analyzer normally rejects this with [`StaticCheckErrorKind::GetBlockInfoExpectPropertyName`] before reaching runtime).
/// - [`RuntimeCheckErrorKind::TypeValueError`] if `args[1]` doesn't evaluate to a `uint`.
/// - [`VmExecutionError`] propagated from [`eval`] when evaluating `args[1]`.
/// - [`VmInternalError`] from database operations when retrieving block information.
Expand Down Expand Up @@ -1091,15 +1091,15 @@ pub fn special_get_block_info(
}

/// Handles the `get-burn-block-info?` special function.
/// Interprets `args` as variables `[property_name, burn_block_height]`, and returns
/// a property value determined by `property_name`:
/// - `header_hash` returns the burn block header hash at `burn_block_height`
/// - `pox_addrs` returns the list of PoX addresses paid out at `burn_block_height`
/// Interprets `args` as variables `[property-name, burn-block-height]`, and returns
/// a property value determined by `property-name`:
/// - `header-hash` returns the burn block header hash at `burn-block-height`
/// - `pox-addrs` returns the list of PoX addresses paid out at `burn-block-height`
///
/// # Errors:
/// - [`RuntimeCheckErrorKind::IncorrectArgumentCount`] if there aren't 2 arguments.
/// - [`RuntimeCheckErrorKind::GetBlockInfoExpectPropertyName`] if `args[0]` isn't a ClarityName.
/// - [`RuntimeCheckErrorKind::NoSuchBurnBlockInfoProperty`] if `args[0]` isn't a [`BurnBlockInfoProperty`].
/// - [`RuntimeCheckErrorKind::Unreachable`] if `args[0]` isn't a ClarityName (the static analyzer normally rejects this).
/// - [`RuntimeCheckErrorKind::Unreachable`] if `args[0]` isn't a [`BurnBlockInfoProperty`] (the static analyzer normally rejects this with [`StaticCheckErrorKind::NoSuchBurnBlockInfoProperty`]).
/// - [`RuntimeCheckErrorKind::TypeValueError`] if `args[1]` doesn't evaluate to a `uint`.
/// - [`RuntimeCheckErrorKind`] cost errors (e.g., `CostOverflow`, `CostBalanceExceeded`) from [`runtime_cost`].
/// - [`VmExecutionError`] propagated from [`eval`] when evaluating `args[1]`.
Expand Down Expand Up @@ -1302,7 +1302,7 @@ pub fn special_get_stacks_block_info(
///
/// # Errors:
/// - [`RuntimeCheckErrorKind::IncorrectArgumentCount`] if there aren't 2 arguments.
/// - [`RuntimeCheckErrorKind::GetTenureInfoExpectPropertyName`] if `args[0]` isn't a ClarityName or isn't a valid [`TenureInfoProperty`].
/// - [`RuntimeCheckErrorKind::Unreachable`] if `args[0]` isn't a ClarityName or isn't a valid [`TenureInfoProperty`] (the static analyzer normally rejects this with [`StaticCheckErrorKind::GetTenureInfoExpectPropertyName`] before reaching runtime).
/// - [`RuntimeCheckErrorKind::TypeValueError`] if `args[1]` doesn't evaluate to a `uint`.
/// - [`RuntimeCheckErrorKind`] cost errors (e.g., `CostOverflow`, `CostBalanceExceeded`) from [`runtime_cost`].
/// - [`VmExecutionError`] propagated from [`eval`] when evaluating `args[1]`.
Expand Down
4 changes: 2 additions & 2 deletions libsigner/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub struct BlockProposalData {
}

impl BlockProposalData {
/// Create a new BlockProposalData for the provided server version and unknown bytes
/// Create a new BlockProposalData for the provided server version and miner diagnostic data.
pub fn new(server_version: String, miner_diagnostic_data: MinerDiagnosticData) -> Self {
Self {
version: BLOCK_PROPOSAL_DATA_VERSION,
Expand Down Expand Up @@ -400,7 +400,7 @@ impl<T: SignerEventTrait> EventReceiver<T> for SignerEventReceiver<T> {

/// Start listening on the given socket address.
/// Returns the address that was bound.
/// Errors out if bind(2) fails
/// Panics if `HttpServer::http()` fails to bind to the listener address.
fn bind(&mut self, listener: SocketAddr) -> Result<SocketAddr, EventError> {
self.http_server = Some(HttpServer::http(listener).expect("failed to start HttpServer"));
self.local_addr = Some(listener);
Expand Down
4 changes: 2 additions & 2 deletions libsigner/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl SignerHttpRequest {
}

/// Decode the HTTP request payload into its headers and body.
/// Returns (verb, path, table of headers, body_offset) on success
/// Returns a `SignerHttpRequest` (verb, path, table of headers, body_offset) on success.
pub fn decode_http_request(payload: &[u8]) -> Result<SignerHttpRequest, EventError> {
// realistically, there won't be more than 32 headers
let mut headers_buf = [httparse::EMPTY_HEADER; MAX_HTTP_HEADERS];
Expand Down Expand Up @@ -123,7 +123,7 @@ pub fn decode_http_request(payload: &[u8]) -> Result<SignerHttpRequest, EventErr
}

/// Decode the HTTP response payload into its headers and body.
/// Return the offset into payload where the body starts, and a table of headers.
/// Return the table of headers and the offset into payload where the body starts.
///
/// If the payload contains a status code other than 200, then RPCERror::HttpError(..) will be
/// returned with the status code.
Expand Down
2 changes: 1 addition & 1 deletion libsigner/src/runloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub trait SignerRunLoop<R: Send, T: SignerEventTrait> {
/// This is the main loop body for the signer. It continuously receives events from
/// `event_recv`, polling for up to `self.get_event_timeout()` units of time. Once it has
/// polled for events, they are fed into `run_one_pass()`. This continues until either
/// `run_one_pass()` returns `false`, or the event receiver hangs up. At this point, this
/// `run_one_pass()` returns `Some(R)`, or the event receiver hangs up. At this point, this
/// method calls the `event_stop_signaler.send()` to terminate the receiver.
///
/// This would run in a separate thread from the event receiver.
Expand Down
2 changes: 1 addition & 1 deletion libsigner/src/signer_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub enum Error {
}

impl SignerEntries {
/// Try to parse the reward set defined by `NakamotoSignEntry` into the SignerEntries struct
/// Try to parse the reward set defined by `NakamotoSignerEntry` into the SignerEntries struct
pub fn parse(is_mainnet: bool, reward_set: &[NakamotoSignerEntry]) -> Result<Self, Error> {
let mut signer_pk_to_id = HashMap::with_capacity(reward_set.len());
let mut signer_id_to_pk = HashMap::with_capacity(reward_set.len());
Expand Down
9 changes: 5 additions & 4 deletions libsigner/src/v0/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ pub struct MockProposal {
}

impl MockProposal {
/// Create a new mock proposal data struct from the provided peer info, chain id, and private key.
/// Create a new mock proposal data struct from the provided peer info and private key.
pub fn new(peer_info: PeerInfo, stacks_private_key: &StacksPrivateKey) -> Self {
let mut sig = Self {
signature: MessageSignature::empty(),
Expand Down Expand Up @@ -1412,7 +1412,7 @@ impl BlockResponse {
}
}

/// Get the block accept data from the block response
/// Get the block rejection data from the block response
pub fn as_block_rejection(&self) -> Option<&BlockRejection> {
match self {
BlockResponse::Rejected(rejection) => Some(rejection),
Expand Down Expand Up @@ -1530,7 +1530,8 @@ pub struct BlockResponseData {
}

impl BlockResponseData {
/// Create a new BlockResponseData for the provided tenure extend timestamp and unknown bytes
/// Create a new BlockResponseData from the provided tenure-extend timestamp, reject reason,
/// tenure-extend read-count timestamp, and failed-tx id. `unknown_bytes` is initialised empty.
pub fn new(
tenure_extend_timestamp: u64,
reject_reason: RejectReason,
Expand Down Expand Up @@ -1625,7 +1626,7 @@ impl StacksMessageCodec for BlockResponseData {
}
}

/// A rejection response from a signer for a proposed block
/// An acceptance response from a signer for a proposed block
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BlockAccepted {
/// The signer signature hash of the block that was accepted
Expand Down
2 changes: 1 addition & 1 deletion pox-locking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! This library provides a contract-call special case handler
//! `crate::handle_contract_call_special_cases()` which matches a
//! contract-call result against zero-address published contracts
//! `pox`, `pox-2`, and `pox-3`. For each of those contracts, it
//! `pox`, `pox-2`, `pox-3`, and `pox-4`. For each of those contracts, it
//! checks if the function called requires applying or updating the
//! `STXBalance` struct's locks, and if the function was successfully
//! invoked. If so, it updates the PoX lock.
Expand Down
10 changes: 5 additions & 5 deletions pox-locking/src/pox_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn is_read_only(func_name: &str) -> bool {
}

/// Parse the returned value from PoX `stack-stx` and `delegate-stack-stx` functions
/// from pox-2.clar or pox-3.clar into a format more readily digestible in rust.
/// from pox-2.clar, pox-3.clar, or pox-4.clar into a format more readily digestible in rust.
/// Panics if the supplied value doesn't match the expected tuple structure
pub fn parse_pox_stacking_result(
result: &Value,
Expand Down Expand Up @@ -98,7 +98,7 @@ pub fn parse_pox_stacking_result(
}
}

/// Parse the returned value from PoX2 or PoX3 `stack-extend` and `delegate-stack-extend` functions
/// Parse the returned value from PoX2, PoX3, or PoX4 `stack-extend` and `delegate-stack-extend` functions
/// into a format more readily digestible in rust.
/// Panics if the supplied value doesn't match the expected tuple structure
pub fn parse_pox_extend_result(result: &Value) -> std::result::Result<(PrincipalData, u64), i128> {
Expand Down Expand Up @@ -133,7 +133,7 @@ pub fn parse_pox_extend_result(result: &Value) -> std::result::Result<(Principal
}
}

/// Parse the returned value from PoX2 or PoX3 `stack-increase` function
/// Parse the returned value from PoX2, PoX3, or PoX4 `stack-increase` function
/// into a format more readily digestible in rust.
/// Panics if the supplied value doesn't match the expected tuple structure
pub fn parse_pox_increase(result: &Value) -> std::result::Result<(PrincipalData, u128), i128> {
Expand Down Expand Up @@ -172,7 +172,7 @@ pub fn parse_pox_increase(result: &Value) -> std::result::Result<(PrincipalData,
/// Returns Ok( account snapshot ) when successful
///
/// # Errors
/// - Returns Error::PoxExtendNotLocked if this function was called on an account
/// - Returns LockingError::PoxExtendNotLocked if this function was called on an account
/// which isn't locked. This *should* have been checked by the PoX v2 contract,
/// so this should surface in a panic.
pub fn pox_lock_increase_v2(
Expand Down Expand Up @@ -225,7 +225,7 @@ pub fn pox_lock_increase_v2(
/// Returns Ok(lock_amount) when successful
///
/// # Errors
/// - Returns Error::PoxExtendNotLocked if this function was called on an account
/// - Returns LockingError::PoxExtendNotLocked if this function was called on an account
/// which isn't locked. This *should* have been checked by the PoX v2 contract,
/// so this should surface in a panic.
pub fn pox_lock_extend_v2(
Expand Down
4 changes: 2 additions & 2 deletions pox-locking/src/pox_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub fn pox_lock_v3(
/// Returns Ok(lock_amount) when successful
///
/// # Errors
/// - Returns Error::PoxExtendNotLocked if this function was called on an account
/// - Returns LockingError::PoxExtendNotLocked if this function was called on an account
/// which isn't locked. This *should* have been checked by the PoX v3 contract,
/// so this should surface in a panic.
pub fn pox_lock_extend_v3(
Expand Down Expand Up @@ -131,7 +131,7 @@ pub fn pox_lock_extend_v3(
/// Returns Ok( account snapshot ) when successful
///
/// # Errors
/// - Returns Error::PoxExtendNotLocked if this function was called on an account
/// - Returns LockingError::PoxExtendNotLocked if this function was called on an account
/// which isn't locked. This *should* have been checked by the PoX v3 contract,
/// so this should surface in a panic.
pub fn pox_lock_increase_v3(
Expand Down
4 changes: 2 additions & 2 deletions pox-locking/src/pox_4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn pox_lock_v4(
/// Returns Ok(lock_amount) when successful
///
/// # Errors
/// - Returns Error::PoxExtendNotLocked if this function was called on an account
/// - Returns LockingError::PoxExtendNotLocked if this function was called on an account
/// which isn't locked. This *should* have been checked by the PoX v4 contract,
/// so this should surface in a panic.
pub fn pox_lock_extend_v4(
Expand Down Expand Up @@ -104,7 +104,7 @@ pub fn pox_lock_extend_v4(
/// Returns Ok( account snapshot ) when successful
///
/// # Errors
/// - Returns Error::PoxExtendNotLocked if this function was called on an account
/// - Returns LockingError::PoxExtendNotLocked if this function was called on an account
/// which isn't locked. This *should* have been checked by the PoX v4 contract,
/// so this should surface in a panic.
pub fn pox_lock_increase_v4(
Expand Down
2 changes: 1 addition & 1 deletion stacks-codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ pub const MAX_PAYLOAD_LEN: u32 = 1 + 16 * 1024 * 1024;
pub const MAX_MESSAGE_LEN: u32 =
MAX_PAYLOAD_LEN + (PREAMBLE_ENCODED_SIZE + MAX_RELAYERS_LEN * RELAY_DATA_ENCODED_SIZE);

/// P2P preamble length (addands correspond to fields above)
/// P2P preamble length (addends correspond to the fields of `blockstack_lib::net::Preamble`, in order).
pub const PREAMBLE_ENCODED_SIZE: u32 = 4
+ 4
+ 4
Expand Down
6 changes: 4 additions & 2 deletions stacks-common/src/util/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ pub fn update_lock_table(conn: &Connection) {
LOCK_TABLE.lock().unwrap().insert(k, v);
}

/// Called by `rusqlite` if we are waiting too long on a database lock
/// If called too many times, will assume a deadlock and panic
/// Called by `rusqlite` if we are waiting too long on a database lock.
/// Logs an error with a backtrace and the current `LOCK_TABLE` every
/// ~5 minutes of accumulated waiting, then keeps sleeping and returning
/// `true` so `rusqlite` retries the lock indefinitely.
pub fn tx_busy_handler(run_count: i32) -> bool {
const AVG_SLEEP_TIME_MS: u64 = 100;

Expand Down
Loading
Loading