// Copyright 2024 Aleo Network Foundation // This file is part of the snarkOS library. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at: // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use crate::common::test_peer::sample_genesis_block; use snarkos_account::Account; use snarkos_node::{Client, Prover, Validator}; use snarkvm::prelude::{MainnetV0 as CurrentNetwork, store::helpers::memory::ConsensusMemory}; use aleo_std::StorageMode; use std::str::FromStr; pub async fn client() -> Client> { Client::new( "127.0.0.1:0".parse().unwrap(), None, 10, Account::::from_str("APrivateKey1zkp2oVPTci9kKcUprnbzMwq95Di1MQERpYBhEeqvkrDirK1").unwrap(), &[], sample_genesis_block(), None, // No CDN. StorageMode::Production, false, // No extra peer rotation. Default::default(), ) .await .expect("couldn't create client instance") } pub async fn prover() -> Prover> { Prover::new( "127.0.0.1:0".parse().unwrap(), Account::::from_str("APrivateKey1zkp2oVPTci9kKcUprnbzMwq95Di1MQERpYBhEeqvkrDirK1").unwrap(), &[], sample_genesis_block(), StorageMode::Production, Default::default(), ) .await .expect("couldn't create prover instance") } pub async fn validator() -> Validator> { Validator::new( "127.0.0.1:0".parse().unwrap(), None, None, 10, Account::::from_str("APrivateKey1zkp2oVPTci9kKcUprnbzMwq95Di1MQERpYBhEeqvkrDirK1").unwrap(), &[], &[], sample_genesis_block(), // Should load the current network's genesis block. None, // No CDN. StorageMode::Production, true, // This test requires validators to connect to peers. false, // No dev traffic in production mode. Default::default(), ) .await .expect("couldn't create validator instance") }