Skip to content

Commit

Permalink
Revert "Revert "Merge pull request AleoNet#3269 from AleoHQ/feat/test…
Browse files Browse the repository at this point in the history
…netv1""

This reverts commit 8c1bba8.
  • Loading branch information
vicsn committed May 28, 2024
1 parent 53cd24c commit 4e315b0
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 70 deletions.
139 changes: 80 additions & 59 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ default-features = false

[workspace.dependencies.snarkvm]
git = "https://github.com/AleoNet/snarkVM.git"
rev = "393b8fb"
rev = "49fa086ed"
#version = "=0.16.18"
features = [ "circuit", "console", "rocks" ]

Expand Down
6 changes: 5 additions & 1 deletion cli/src/commands/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use snarkvm::{
console::{
account::{Address, PrivateKey, Signature},
network::{MainnetV0, Network, TestnetV0},
network::{CanaryV0, MainnetV0, Network, TestnetV0},
prelude::{Environment, Uniform},
program::{ToFields, Value},
types::Field,
Expand Down Expand Up @@ -113,12 +113,14 @@ impl Account {
Some(vanity) => match network {
MainnetV0::ID => Self::new_vanity::<MainnetV0>(vanity.as_str(), discreet),
TestnetV0::ID => Self::new_vanity::<TestnetV0>(vanity.as_str(), discreet),
CanaryV0::ID => Self::new_vanity::<CanaryV0>(vanity.as_str(), discreet),
unknown_id => bail!("Unknown network ID ({unknown_id})"),
},
// Generate a seeded account for the specified network.
None => match network {
MainnetV0::ID => Self::new_seeded::<MainnetV0>(seed, discreet),
TestnetV0::ID => Self::new_seeded::<TestnetV0>(seed, discreet),
CanaryV0::ID => Self::new_seeded::<CanaryV0>(seed, discreet),
unknown_id => bail!("Unknown network ID ({unknown_id})"),
},
}
Expand All @@ -140,6 +142,7 @@ impl Account {
match network {
MainnetV0::ID => Self::sign::<MainnetV0>(key, message, seed, raw),
TestnetV0::ID => Self::sign::<TestnetV0>(key, message, seed, raw),
CanaryV0::ID => Self::sign::<CanaryV0>(key, message, seed, raw),
unknown_id => bail!("Unknown network ID ({unknown_id})"),
}
}
Expand All @@ -148,6 +151,7 @@ impl Account {
match network {
MainnetV0::ID => Self::verify::<MainnetV0>(address, signature, message, raw),
TestnetV0::ID => Self::verify::<TestnetV0>(address, signature, message, raw),
CanaryV0::ID => Self::verify::<CanaryV0>(address, signature, message, raw),
unknown_id => bail!("Unknown network ID ({unknown_id})"),
}
}
Expand Down
3 changes: 2 additions & 1 deletion cli/src/commands/developer/decrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use snarkvm::{
console::{
network::{MainnetV0, Network, TestnetV0},
network::{CanaryV0, MainnetV0, Network, TestnetV0},
program::Ciphertext,
},
prelude::{Record, ViewKey},
Expand Down Expand Up @@ -45,6 +45,7 @@ impl Decrypt {
match self.network {
MainnetV0::ID => Self::decrypt_ciphertext::<MainnetV0>(&self.ciphertext, &self.view_key),
TestnetV0::ID => Self::decrypt_ciphertext::<TestnetV0>(&self.ciphertext, &self.view_key),
CanaryV0::ID => Self::decrypt_ciphertext::<CanaryV0>(&self.ciphertext, &self.view_key),
unknown_id => bail!("Unknown network ID ({unknown_id})"),
}
}
Expand Down
5 changes: 3 additions & 2 deletions cli/src/commands/developer/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

use super::Developer;
use snarkvm::{
circuit::{Aleo, AleoTestnetV0, AleoV0},
circuit::{Aleo, AleoCanaryV0, AleoTestnetV0, AleoV0},
console::{
network::{MainnetV0, Network, TestnetV0},
network::{CanaryV0, MainnetV0, Network, TestnetV0},
program::ProgramOwner,
},
prelude::{
Expand Down Expand Up @@ -93,6 +93,7 @@ impl Deploy {
match self.network {
MainnetV0::ID => self.construct_deployment::<MainnetV0, AleoV0>(),
TestnetV0::ID => self.construct_deployment::<TestnetV0, AleoTestnetV0>(),
CanaryV0::ID => self.construct_deployment::<CanaryV0, AleoCanaryV0>(),
unknown_id => bail!("Unknown network ID ({unknown_id})"),
}
}
Expand Down
3 changes: 2 additions & 1 deletion cli/src/commands/developer/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use super::Developer;
use snarkvm::{
console::network::{MainnetV0, Network, TestnetV0},
console::network::{CanaryV0, MainnetV0, Network, TestnetV0},
prelude::{
query::Query,
store::{helpers::memory::ConsensusMemory, ConsensusStore},
Expand Down Expand Up @@ -94,6 +94,7 @@ impl Execute {
match self.network {
MainnetV0::ID => self.construct_execution::<MainnetV0>(),
TestnetV0::ID => self.construct_execution::<TestnetV0>(),
CanaryV0::ID => self.construct_execution::<CanaryV0>(),
unknown_id => bail!("Unknown network ID ({unknown_id})"),
}
}
Expand Down
2 changes: 2 additions & 0 deletions cli/src/commands/developer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ impl Developer {
let network = match N::ID {
snarkvm::console::network::MainnetV0::ID => "mainnet",
snarkvm::console::network::TestnetV0::ID => "testnet",
snarkvm::console::network::CanaryV0::ID => "canary",
unknown_id => bail!("Unknown network ID ({unknown_id})"),
};

Expand Down Expand Up @@ -147,6 +148,7 @@ impl Developer {
let network = match N::ID {
snarkvm::console::network::MainnetV0::ID => "mainnet",
snarkvm::console::network::TestnetV0::ID => "testnet",
snarkvm::console::network::CanaryV0::ID => "canary",
unknown_id => bail!("Unknown network ID ({unknown_id})"),
};

Expand Down
6 changes: 5 additions & 1 deletion cli/src/commands/developer/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#![allow(clippy::type_complexity)]

use snarkvm::{
console::network::{MainnetV0, Network, TestnetV0},
console::network::{CanaryV0, MainnetV0, Network, TestnetV0},
prelude::{block::Block, Ciphertext, Field, FromBytes, Plaintext, PrivateKey, Record, ViewKey},
};

Expand Down Expand Up @@ -71,6 +71,7 @@ impl Scan {
match self.network {
MainnetV0::ID => self.scan_records::<MainnetV0>(),
TestnetV0::ID => self.scan_records::<TestnetV0>(),
CanaryV0::ID => self.scan_records::<CanaryV0>(),
unknown_id => bail!("Unknown network ID ({unknown_id})"),
}
}
Expand Down Expand Up @@ -135,6 +136,7 @@ impl Scan {
let network = match self.network {
MainnetV0::ID => "mainnet",
TestnetV0::ID => "testnet",
CanaryV0::ID => "canary",
unknown_id => bail!("Unknown network ID ({unknown_id})"),
};

Expand Down Expand Up @@ -186,6 +188,7 @@ impl Scan {
let network = match N::ID {
MainnetV0::ID => "mainnet",
TestnetV0::ID => "testnet",
CanaryV0::ID => "canary",
unknown_id => bail!("Unknown network ID ({unknown_id})"),
};

Expand Down Expand Up @@ -364,6 +367,7 @@ impl Scan {
let network = match N::ID {
MainnetV0::ID => "mainnet",
TestnetV0::ID => "testnet",
CanaryV0::ID => "canary",
unknown_id => bail!("Unknown network ID ({unknown_id})"),
};

Expand Down
3 changes: 2 additions & 1 deletion cli/src/commands/developer/transfer_private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use super::Developer;
use snarkvm::{
console::network::{MainnetV0, Network, TestnetV0},
console::network::{CanaryV0, MainnetV0, Network, TestnetV0},
prelude::{
query::Query,
store::{helpers::memory::ConsensusMemory, ConsensusStore},
Expand Down Expand Up @@ -93,6 +93,7 @@ impl TransferPrivate {
match self.network {
MainnetV0::ID => self.construct_transfer_private::<MainnetV0>(),
TestnetV0::ID => self.construct_transfer_private::<TestnetV0>(),
CanaryV0::ID => self.construct_transfer_private::<CanaryV0>(),
unknown_id => bail!("Unknown network ID ({unknown_id})"),
}
}
Expand Down
11 changes: 10 additions & 1 deletion cli/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use snarkvm::{
console::{
account::{Address, PrivateKey},
algorithms::Hash,
network::{MainnetV0, Network, TestnetV0},
network::{CanaryV0, MainnetV0, Network, TestnetV0},
},
ledger::{
block::Block,
Expand Down Expand Up @@ -189,6 +189,15 @@ impl Start {
Display::start(node, log_receiver).expect("Failed to initialize the display");
}
}
CanaryV0::ID => {
// Parse the node from the configurations.
let node = cli.parse_node::<CanaryV0>(shutdown.clone()).await.expect("Failed to parse the node");
// If the display is enabled, render the display.
if !cli.nodisplay {
// Initialize the display.
Display::start(node, log_receiver).expect("Failed to initialize the display");
}
}
_ => panic!("Invalid network ID specified"),
};
// Note: Do not move this. The pending await must be here otherwise
Expand Down
2 changes: 1 addition & 1 deletion devnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ read -p "Enter the total number of clients (default: 2): " total_clients
total_clients=${total_clients:-2}

# Read the network ID from user or use a default value of 1
read -p "Enter the network ID (mainnet = 0, testnet = 1) (default: 1): " network_id
read -p "Enter the network ID (mainnet = 0, testnet = 1, canary = 2) (default: 1): " network_id
network_id=${network_id:-1}

# Ask the user if they want to run 'cargo install --locked --path .' or use a pre-installed binary
Expand Down
1 change: 1 addition & 0 deletions node/rest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ impl<N: Network, C: ConsensusStorage<N>, R: Routing<N>> Rest<N, C, R> {
let network = match N::ID {
snarkvm::console::network::MainnetV0::ID => "mainnet",
snarkvm::console::network::TestnetV0::ID => "testnet",
snarkvm::console::network::CanaryV0::ID => "canary",
unknown_id => {
eprintln!("Unknown network ID ({unknown_id})");
return;
Expand Down
7 changes: 6 additions & 1 deletion node/router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,18 @@ impl<N: Network> Router<N> {
// TODO: Populate me with Mainnet Beta IP addresses.
]
} else if N::ID == snarkvm::console::network::TestnetV0::ID {
// Testnet contains the following bootstrap peers.
// TestnetV0 contains the following bootstrap peers.
vec![
SocketAddr::from_str("34.168.118.156:4130").unwrap(),
SocketAddr::from_str("35.231.152.213:4130").unwrap(),
SocketAddr::from_str("34.17.53.129:4130").unwrap(),
SocketAddr::from_str("35.200.149.162:4130").unwrap(),
]
} else if N::ID == snarkvm::console::network::CanaryV0::ID {
// CanaryV0 contains the following bootstrap peers.
vec![
// TODO: Populate me with CanaryV0 IP addresses.
]
} else {
// Unrecognized networks contain no bootstrap peers.
vec![]
Expand Down

0 comments on commit 4e315b0

Please sign in to comment.