Update Testnet3 to Mainnet

This commit is contained in:
Pranav Gaddamadugu 2024-04-01 06:43:54 -07:00
parent b1f6922d1e
commit 4fe984ce7c
10 changed files with 26 additions and 26 deletions

View File

@ -1,8 +1,8 @@
name: Testnet3 Crates Docs
name: Mainnet Crates Docs
on:
push:
branches:
- testnet3
- mainnet
jobs:
build-crates-docs:

View File

@ -45,7 +45,7 @@ use std::{
rc::Rc,
};
pub type CurrentNetwork = Testnet3;
pub type CurrentNetwork = MainnetV0;
#[allow(unused)]
pub type CurrentAleo = snarkvm::circuit::AleoV0;

View File

@ -18,7 +18,7 @@ use super::*;
use leo_errors::{ParserError, Result};
use leo_span::sym;
use snarkvm::console::{account::Address, network::Testnet3};
use snarkvm::console::{account::Address, network::MainnetV0};
const INT_TYPES: &[Token] = &[
Token::I8,
@ -732,7 +732,7 @@ impl ParserContext<'_> {
Token::True => Expression::Literal(Literal::Boolean(true, span, self.node_builder.next_id())),
Token::False => Expression::Literal(Literal::Boolean(false, span, self.node_builder.next_id())),
Token::AddressLit(address_string) => {
if address_string.parse::<Address<Testnet3>>().is_err() {
if address_string.parse::<Address<MainnetV0>>().is_err() {
self.emit_err(ParserError::invalid_address_lit(&address_string, span));
}
Expression::Literal(Literal::Address(address_string, span, self.node_builder.next_id()))

View File

@ -21,7 +21,7 @@ use leo_errors::{emitter::Handler, TypeCheckerError};
use leo_span::{sym, Span};
use itertools::Itertools;
use snarkvm::console::network::{Network, Testnet3};
use snarkvm::console::network::{MainnetV0, Network};
use std::str::FromStr;
fn return_incorrect_type(t1: Option<Type>, t2: Option<Type>, expected: &Option<Type>) -> Option<Type> {
@ -279,7 +279,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
None
}
// Check that the element types match.
1..=Testnet3::MAX_ARRAY_ELEMENTS => {
1..=MainnetV0::MAX_ARRAY_ELEMENTS => {
let mut element_types = element_types.into_iter();
// Note that this unwrap is safe because we already checked that the array is not empty.
element_types.next().unwrap().map(|first_type| {
@ -295,7 +295,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
num_elements => {
self.emit_err(TypeCheckerError::array_too_large(
num_elements,
Testnet3::MAX_ARRAY_ELEMENTS,
MainnetV0::MAX_ARRAY_ELEMENTS,
input.span(),
));
None

View File

@ -20,7 +20,7 @@ use leo_ast::*;
use leo_errors::TypeCheckerError;
use leo_span::sym;
use snarkvm::console::network::{Network, Testnet3};
use snarkvm::console::network::{MainnetV0, Network};
use std::collections::HashSet;
@ -132,9 +132,9 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
}
// Check that the number of mappings does not exceed the maximum.
if mapping_count > Testnet3::MAX_MAPPINGS {
if mapping_count > MainnetV0::MAX_MAPPINGS {
self.emit_err(TypeCheckerError::too_many_mappings(
Testnet3::MAX_MAPPINGS,
MainnetV0::MAX_MAPPINGS,
input.program_id.name.span + input.program_id.network.span,
));
}
@ -155,9 +155,9 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
// TODO: Need similar checks for structs (all in separate PR)
// Check that the number of transitions does not exceed the maximum.
if transition_count > Testnet3::MAX_FUNCTIONS {
if transition_count > MainnetV0::MAX_FUNCTIONS {
self.emit_err(TypeCheckerError::too_many_transitions(
Testnet3::MAX_FUNCTIONS,
MainnetV0::MAX_FUNCTIONS,
input.program_id.name.span + input.program_id.network.span,
));
}

View File

@ -35,7 +35,7 @@ use leo_ast::{
use leo_errors::{emitter::Handler, TypeCheckerError};
use leo_span::{Span, Symbol};
use snarkvm::console::network::{Network, Testnet3};
use snarkvm::console::network::{MainnetV0, Network};
use itertools::Itertools;
use std::cell::RefCell;
@ -1176,9 +1176,9 @@ impl<'a> TypeChecker<'a> {
// Check that the array length is valid.
match array_type.length() {
0 => self.emit_err(TypeCheckerError::array_empty(span)),
1..=Testnet3::MAX_ARRAY_ELEMENTS => {}
1..=MainnetV0::MAX_ARRAY_ELEMENTS => {}
length => {
self.emit_err(TypeCheckerError::array_too_large(length, Testnet3::MAX_ARRAY_ELEMENTS, span))
self.emit_err(TypeCheckerError::array_too_large(length, MainnetV0::MAX_ARRAY_ELEMENTS, span))
}
}
// Check that the array element type is valid.

View File

@ -25,7 +25,7 @@ use leo_span::Symbol;
use snarkvm::{
package::Package,
prelude::{ProgramID, Testnet3},
prelude::{MainnetV0, ProgramID},
};
use indexmap::IndexMap;
@ -34,7 +34,7 @@ use std::{
path::{Path, PathBuf},
};
type CurrentNetwork = Testnet3;
type CurrentNetwork = MainnetV0;
impl From<BuildOptions> for CompilerOptions {
fn from(options: BuildOptions) -> Self {
@ -138,7 +138,7 @@ impl Command for Build {
for file_path in local_source_files {
compile_leo_file(
file_path,
&ProgramID::<Testnet3>::try_from(format!("{}.aleo", dependency))
&ProgramID::<MainnetV0>::try_from(format!("{}.aleo", dependency))
.map_err(|_| UtilError::snarkvm_error_building_program_id(Default::default()))?,
&local_outputs_directory,
&local_build_directory,
@ -182,7 +182,7 @@ impl Command for Build {
#[allow(clippy::too_many_arguments)]
fn compile_leo_file(
file_path: PathBuf,
program_id: &ProgramID<Testnet3>,
program_id: &ProgramID<MainnetV0>,
outputs: &Path,
build: &Path,
handler: &Handler,

View File

@ -23,7 +23,7 @@ pub use commands::*;
mod helpers;
pub use helpers::*;
pub(crate) type CurrentNetwork = snarkvm::prelude::Testnet3;
pub(crate) type CurrentNetwork = snarkvm::prelude::MainnetV0;
pub(crate) const SNARKVM_COMMAND: &str = "snarkvm";
#[cfg(test)]

View File

@ -169,7 +169,7 @@ impl<N: Network> Package<N> {
mod tests {
use super::*;
type CurrentNetwork = snarkvm::prelude::Testnet3;
type CurrentNetwork = snarkvm::prelude::MainnetV0;
#[test]
fn test_is_package_name_valid() {

View File

@ -15,11 +15,11 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use snarkvm::{
prelude::{Itertools, Network, Testnet3},
prelude::{Itertools, MainnetV0, Network},
synthesizer::program::{CommandTrait, InstructionTrait, Program, ProgramCore},
};
use std::str::FromStr;
type CurrentNetwork = Testnet3;
type CurrentNetwork = MainnetV0;
use leo_ast::{Composite, FunctionStub, Identifier, Mapping, ProgramId, Stub};
use leo_errors::UtilError;
@ -82,10 +82,10 @@ pub fn disassemble_from_str(program: &str) -> Result<Stub, UtilError> {
mod tests {
use super::*;
use leo_span::symbol::create_session_if_not_set_then;
use snarkvm::{prelude::Testnet3, synthesizer::program::Program};
use snarkvm::{prelude::MainnetV0, synthesizer::program::Program};
use std::fs;
type CurrentNetwork = Testnet3;
type CurrentNetwork = MainnetV0;
#[test]
#[ignore]