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

fix: print-env when missing data #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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: 8 additions & 4 deletions sui/cli/src/db/print_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ use crate::prelude::*;

pub(crate) async fn command(context: &mut Context) -> Result<()> {
let package = context.unwrap_package_id();
let atoma_db = context.get_or_load_atoma_db().await?;
let manager_badge = context.get_or_load_db_manager_badge().await?;
let atoma_db = context.get_or_load_atoma_db().await.ok();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you encounter this error anyway? There should always be atoma DB and manager badge if you provide a correct package ID. Not sure if we should be silent on the error because that means something went very wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when I register a node from a non admin account

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't matter if it's non admin or not, everyone needs to know atoma DB and everyone can know it. What error did you get? Can you replicate? You cannot register a node without knowing the object ID of the DB.

let manager_badge = context.get_or_load_db_manager_badge().await.ok();
let node_info = context.get_or_load_node_badge().await.ok();
let toma_wallet = context.get_or_load_toma_wallet().await.ok();

println!("WALLET_PATH={}", context.unwrap_wallet_path().display());
println!("PACKAGE_ID={package}");
println!("ATOMA_DB_ID={atoma_db}");
println!("MANAGER_BADGE_ID={manager_badge}");
if let Some(atoma_db) = atoma_db {
println!("ATOMA_DB_ID={atoma_db}");
}
if let Some(manager_badge) = manager_badge {
println!("MANAGER_BADGE_ID={manager_badge}");
}
if let Some((node_badge, node_id)) = node_info {
println!("NODE_BADGE_ID={node_badge}");
println!("NODE_ID={node_id}");
Expand Down