#![forbid(unsafe_code)]
#![allow(clippy::too_many_arguments)]
#![warn(clippy::cast_possible_truncation)]
#[macro_use]
extern crate lazy_static;
pub use snarkvm_console_network_environment as environment;
pub use snarkvm_console_network_environment::*;
mod helpers;
pub use helpers::*;
mod testnet3;
pub use testnet3::*;
pub mod prelude {
pub use crate::{environment::prelude::*, Network};
}
use crate::environment::prelude::*;
use snarkvm_algorithms::{
crypto_hash::PoseidonSponge,
snark::marlin::{CircuitProvingKey, CircuitVerifyingKey, MarlinHidingMode},
AlgebraicSponge,
};
use snarkvm_console_algorithms::{Poseidon2, Poseidon4, BHP1024, BHP512};
use snarkvm_console_collections::merkle_tree::{MerklePath, MerkleTree};
use snarkvm_console_types::{Field, Group, Scalar};
use snarkvm_curves::PairingEngine;
use indexmap::IndexMap;
use once_cell::sync::OnceCell;
use std::sync::Arc;
pub type BHPMerkleTree<N, const DEPTH: u8> = MerkleTree<N, BHP1024<N>, BHP512<N>, DEPTH>;
pub type PoseidonMerkleTree<N, const DEPTH: u8> = MerkleTree<N, Poseidon4<N>, Poseidon2<N>, DEPTH>;
type Fq<N> = <<N as Environment>::PairingCurve as PairingEngine>::Fq;
pub type FiatShamir<N> = PoseidonSponge<Fq<N>, 2, 1>;
pub type FiatShamirParameters<N> = <FiatShamir<N> as AlgebraicSponge<Fq<N>, 2>>::Parameters;
pub(crate) type MarlinProvingKey<N> = CircuitProvingKey<<N as Environment>::PairingCurve, MarlinHidingMode>;
pub(crate) type MarlinVerifyingKey<N> = CircuitVerifyingKey<<N as Environment>::PairingCurve, MarlinHidingMode>;
pub trait Network:
'static
+ Environment
+ Copy
+ Clone
+ Debug
+ Eq
+ PartialEq
+ core::hash::Hash
+ Serialize
+ DeserializeOwned
+ for<'a> Deserialize<'a>
+ Send
+ Sync
{
const ID: u16;
const NAME: &'static str;
const EDITION: u16;
const INCLUSION_FUNCTION_NAME: &'static str;
const GENESIS_TIMESTAMP: i64 = 1663718400; const GENESIS_COINBASE_TARGET: u64 = (1u64 << 10).saturating_sub(1); const GENESIS_PROOF_TARGET: u64 = 8;
const STARTING_SUPPLY: u64 = 1_100_000_000_000_000;
const ANCHOR_TIME: u16 = 25;
const COINBASE_PUZZLE_DEGREE: u32 = (1 << 13) - 1; const MAX_PROVER_SOLUTIONS: usize = 1 << 20; const NUM_BLOCKS_PER_EPOCH: u32 = 1 << 8;
const MAX_DATA_DEPTH: usize = 32;
const MAX_DATA_ENTRIES: usize = 32;
#[allow(clippy::cast_possible_truncation)]
const MAX_DATA_SIZE_IN_FIELDS: u32 = ((128 * 1024 * 8) / Field::<Self>::SIZE_IN_DATA_BITS) as u32;
const MAX_FUNCTIONS: usize = 15;
const MAX_OPERANDS: usize = Self::MAX_INPUTS;
const MAX_INSTRUCTIONS: usize = u16::MAX as usize;
const MAX_COMMANDS: usize = u8::MAX as usize;
const MAX_INPUTS: usize = 8;
const MAX_OUTPUTS: usize = 8;
type StateRoot: Bech32ID<Field<Self>>;
type BlockHash: Bech32ID<Field<Self>>;
type TransactionID: Bech32ID<Field<Self>>;
type TransitionID: Bech32ID<Field<Self>>;
fn genesis_bytes() -> &'static [u8];
fn get_credits_proving_key(function_name: String) -> Result<&'static Arc<MarlinProvingKey<Self>>>;
fn get_credits_verifying_key(function_name: String) -> Result<&'static Arc<MarlinVerifyingKey<Self>>>;
fn inclusion_proving_key() -> &'static Arc<MarlinProvingKey<Self>>;
fn inclusion_verifying_key() -> &'static Arc<MarlinVerifyingKey<Self>>;
fn g_powers() -> &'static Vec<Group<Self>>;
fn g_scalar_multiply(scalar: &Scalar<Self>) -> Group<Self>;
fn marlin_fs_parameters() -> &'static FiatShamirParameters<Self>;
fn bcm_domain() -> Field<Self>;
fn encryption_domain() -> Field<Self>;
fn graph_key_domain() -> Field<Self>;
fn randomizer_domain() -> Field<Self>;
fn r_bcm_domain() -> Field<Self>;
fn serial_number_domain() -> Field<Self>;
fn commit_bhp256(input: &[bool], randomizer: &Scalar<Self>) -> Result<Field<Self>>;
fn commit_bhp512(input: &[bool], randomizer: &Scalar<Self>) -> Result<Field<Self>>;
fn commit_bhp768(input: &[bool], randomizer: &Scalar<Self>) -> Result<Field<Self>>;
fn commit_bhp1024(input: &[bool], randomizer: &Scalar<Self>) -> Result<Field<Self>>;
fn commit_ped64(input: &[bool], randomizer: &Scalar<Self>) -> Result<Group<Self>>;
fn commit_ped128(input: &[bool], randomizer: &Scalar<Self>) -> Result<Group<Self>>;
fn hash_bhp256(input: &[bool]) -> Result<Field<Self>>;
fn hash_bhp512(input: &[bool]) -> Result<Field<Self>>;
fn hash_bhp768(input: &[bool]) -> Result<Field<Self>>;
fn hash_bhp1024(input: &[bool]) -> Result<Field<Self>>;
fn hash_ped64(input: &[bool]) -> Result<Field<Self>>;
fn hash_ped128(input: &[bool]) -> Result<Field<Self>>;
fn hash_psd2(input: &[Field<Self>]) -> Result<Field<Self>>;
fn hash_psd4(input: &[Field<Self>]) -> Result<Field<Self>>;
fn hash_psd8(input: &[Field<Self>]) -> Result<Field<Self>>;
fn hash_many_psd2(input: &[Field<Self>], num_outputs: u16) -> Vec<Field<Self>>;
fn hash_many_psd4(input: &[Field<Self>], num_outputs: u16) -> Vec<Field<Self>>;
fn hash_many_psd8(input: &[Field<Self>], num_outputs: u16) -> Vec<Field<Self>>;
fn hash_to_group_psd2(input: &[Field<Self>]) -> Result<Group<Self>>;
fn hash_to_group_psd4(input: &[Field<Self>]) -> Result<Group<Self>>;
fn hash_to_group_psd8(input: &[Field<Self>]) -> Result<Group<Self>>;
fn hash_to_scalar_psd2(input: &[Field<Self>]) -> Result<Scalar<Self>>;
fn hash_to_scalar_psd4(input: &[Field<Self>]) -> Result<Scalar<Self>>;
fn hash_to_scalar_psd8(input: &[Field<Self>]) -> Result<Scalar<Self>>;
fn merkle_tree_bhp<const DEPTH: u8>(leaves: &[Vec<bool>]) -> Result<BHPMerkleTree<Self, DEPTH>>;
fn merkle_tree_psd<const DEPTH: u8>(leaves: &[Vec<Field<Self>>]) -> Result<PoseidonMerkleTree<Self, DEPTH>>;
#[allow(clippy::ptr_arg)]
fn verify_merkle_path_bhp<const DEPTH: u8>(
path: &MerklePath<Self, DEPTH>,
root: &Field<Self>,
leaf: &Vec<bool>,
) -> bool;
#[allow(clippy::ptr_arg)]
fn verify_merkle_path_psd<const DEPTH: u8>(
path: &MerklePath<Self, DEPTH>,
root: &Field<Self>,
leaf: &Vec<Field<Self>>,
) -> bool;
}