Skip to content

Commit f32cf7f

Browse files
committed
Core: make cargo test --doc -p mina-core happy
1 parent 07dc5e3 commit f32cf7f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

core/src/chain_id.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
//! ```rust
5757
//! use mina_core::ChainId;
5858
//!
59+
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
5960
//! // Use predefined network
6061
//! let mainnet_id = mina_core::MAINNET_CHAIN_ID;
6162
//! println!("Mainnet ID: {}", mainnet_id);
@@ -65,6 +66,8 @@
6566
//!
6667
//! // Generate preshared key for private networking
6768
//! let psk = chain_id.preshared_key();
69+
//! # Ok(())
70+
//! # }
6871
//! ```
6972
7073
use mina_p2p_messages::v2::{
@@ -135,6 +138,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
135138
/// ```rust
136139
/// use mina_core::{ChainId, MAINNET_CHAIN_ID};
137140
///
141+
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
138142
/// // Use predefined mainnet ID
139143
/// let mainnet = MAINNET_CHAIN_ID;
140144
/// println!("Mainnet: {}", mainnet.to_hex());
@@ -144,6 +148,8 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
144148
///
145149
/// // Generate private network key
146150
/// let psk = mainnet.preshared_key();
151+
/// # Ok(())
152+
/// # }
147153
/// ```
148154
#[derive(Clone, PartialEq, Eq)]
149155
pub struct ChainId([u8; 32]);
@@ -221,6 +227,11 @@ impl ChainId {
221227
/// use mina_core::ChainId;
222228
/// use mina_p2p_messages::v2::UnsignedExtendedUInt32StableV1;
223229
///
230+
/// # // Use actual devnet values for the example
231+
/// # let constraint_digests = mina_core::network::devnet::CONSTRAINT_SYSTEM_DIGESTS;
232+
/// # let genesis_hash: mina_p2p_messages::v2::StateHash =
233+
/// # "3NL93SipJfAMNDBRfQ8Uo8LPovC74mnJZfZYB5SK7mTtkL72dsPx".parse().unwrap();
234+
/// # let protocol_constants = mina_core::constants::PROTOCOL_CONSTANTS.clone();
224235
/// let chain_id = ChainId::compute(
225236
/// &constraint_digests,
226237
/// &genesis_hash,
@@ -349,9 +360,12 @@ impl ChainId {
349360
/// ```rust
350361
/// use mina_core::ChainId;
351362
///
363+
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
352364
/// let chain_id = ChainId::from_hex(
353365
/// "a7351abc7ddf2ea92d1b38cc8e636c271c1dfd2c081c637f62ebc2af34eb7cc1"
354366
/// )?;
367+
/// # Ok(())
368+
/// # }
355369
/// ```
356370
pub fn from_hex(s: &str) -> Result<ChainId, hex::FromHexError> {
357371
let h = hex::decode(s)?;

0 commit comments

Comments
 (0)