Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data and document to dev genesis block identifier #3409

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions cli/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,10 @@ fn load_or_compute_genesis<N: Network>(

// Input the network ID.
preimage.extend(&N::ID.to_le_bytes());
// Input the genesis coinbase target.
preimage.extend(&to_bytes_le![N::GENESIS_COINBASE_TARGET]?);
// Input the genesis proof target.
preimage.extend(&to_bytes_le![N::GENESIS_PROOF_TARGET]?);

// Input the genesis private key, committee, and public balances.
preimage.extend(genesis_private_key.to_bytes_le()?);
Expand Down Expand Up @@ -745,6 +749,8 @@ fn load_or_compute_genesis<N: Network>(
// Initialize the hasher.
let hasher = snarkvm::console::algorithms::BHP256::<N>::setup("aleo.dev.block")?;
// Compute the hash.
// NOTE: this is a fast-to-compute but *IMPERFECT* identifier for the genesis block.
// to know the actualy genesis block hash, you need to compute the block itself.
let hash = hasher.hash(&preimage.to_bits_le())?.to_string();

// A closure to load the block.
Expand Down