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

Subnet evm id update #91

Merged
merged 4 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 10 additions & 2 deletions crates/ash_cli/src/utils/templating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,15 @@ pub(crate) fn template_avalanche_subnet_props_table(

props_table.add_row(row![
"ID".bold(),
type_colorize(&avalanche_subnet.subnet_status.clone().unwrap().id.clone().unwrap_or_default()),
type_colorize(
&avalanche_subnet
.subnet_status
.clone()
.unwrap()
.id
.clone()
.unwrap_or_default()
),
]);
props_table.add_row(row![
"Validators",
Expand All @@ -1131,7 +1139,7 @@ pub(crate) fn template_avalanche_subnet_props_table(
.len()
),
]);

// TODO: Add the rest of the Subnet properties

props_table
Expand Down
5 changes: 2 additions & 3 deletions crates/ash_sdk/src/avalanche/blockchains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,11 @@ impl From<Blockchain> for AvalancheBlockchain {
#[cfg(test)]
mod tests {
use super::*;
use crate::avalanche::{vms::encode_genesis_data, AvalancheNetwork, AvalancheSubnet};
use crate::avalanche::{vms::{encode_genesis_data, subnet_evm::AVAX_SUBNET_EVM_ID}, AvalancheNetwork, AvalancheSubnet};
use std::{env, fs, str::FromStr};

const AVAX_EWOQ_PRIVATE_KEY: &str =
"PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN";
const SUBNET_EVM_VM_ID: &str = "spePNvBxaWSYL2tB5e2xMmMNBQkXMN8z2XEbz1ML2Aahatwoc";

// Load the test network from the ASH_TEST_CONFIG file
fn load_test_network() -> AvalancheNetwork {
Expand Down Expand Up @@ -232,7 +231,7 @@ mod tests {
created_subnet.id,
"testAvalancheBlockchainCreate",
AvalancheVmType::SubnetEVM,
Id::from_str(SUBNET_EVM_VM_ID).unwrap(),
Id::from_str(AVAX_SUBNET_EVM_ID).unwrap(),
genesis_data,
true,
)
Expand Down
7 changes: 3 additions & 4 deletions crates/ash_sdk/src/avalanche/txs/p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub async fn add_avalanche_validator(
mod tests {
use super::*;
use crate::avalanche::{
vms::{encode_genesis_data, AvalancheVmType},
vms::{encode_genesis_data, AvalancheVmType, subnet_evm::AVAX_SUBNET_EVM_ID},
AvalancheNetwork,
};
use chrono::Duration;
Expand All @@ -173,7 +173,6 @@ mod tests {
const AVAX_EWOQ_PRIVATE_KEY: &str =
"PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN";
const NETWORK_RUNNER_PCHAIN_ADDR: &str = "P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p";
const SUBNET_EVM_VM_ID: &str = "spePNvBxaWSYL2tB5e2xMmMNBQkXMN8z2XEbz1ML2Aahatwoc";
const NETWORK_RUNNER_NODE_ID: &str = "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg";

// Load the test network using avalanche-network-runner
Expand Down Expand Up @@ -220,7 +219,7 @@ mod tests {
&local_wallet,
subnet_id,
genesis_data,
Id::from_str(SUBNET_EVM_VM_ID).unwrap(),
Id::from_str(AVAX_SUBNET_EVM_ID).unwrap(),
"testCreateBlockchain",
true,
)
Expand All @@ -236,7 +235,7 @@ mod tests {
let blockchain = subnet.get_blockchain(tx_id).unwrap();

assert_eq!(blockchain.name, "testCreateBlockchain");
assert_eq!(blockchain.vm_id, Id::from_str(SUBNET_EVM_VM_ID).unwrap());
assert_eq!(blockchain.vm_id, Id::from_str(AVAX_SUBNET_EVM_ID).unwrap());
}

#[async_std::test]
Expand Down
2 changes: 1 addition & 1 deletion crates/ash_sdk/src/avalanche/vms/subnet_evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::errors::*;
use avalanche_types::subnet_evm::genesis::Genesis;

/// Known ID for the Subnet-EVM
pub const AVAX_SUBNET_EVM_ID: &str = "spePNvBxaWSYL2tB5e2xMmMNBQkXMN8z2XEbz1ML2Aahatwoc";
pub const AVAX_SUBNET_EVM_ID: &str = "srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy";

/// Encode the genesis data (JSON) to bytes
pub fn encode_genesis_data(genesis_json: &str) -> Result<Vec<u8>, AshError> {
Expand Down
2 changes: 1 addition & 1 deletion crates/ash_sdk/src/avalanche/wallets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub struct AvalancheWalletInfo {
/// EVM address
pub evm_address: String,
/// Hex-encoded private key
pub hex_private_key : String,
pub hex_private_key: String,
/// CB58-encoded private key
pub cb58_private_key: String,
}
Expand Down
Loading