Skip to content
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
3 changes: 1 addition & 2 deletions lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ pub async fn query_global_state(
let rpc_id = parse::rpc_id(maybe_rpc_id);
let verbosity = parse::verbosity(verbosity_level);
let global_state_identifier =
parse::global_state_identifier(maybe_block_id, maybe_state_root_hash)?
.ok_or(CliError::FailedToParseStateIdentifier)?;
parse::global_state_identifier(maybe_block_id, maybe_state_root_hash)?;
let key = parse::key_for_query(key)?;
let path = if path.is_empty() {
vec![]
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use crate::cli::JsonArgsError;
#[cfg(doc)]
use crate::rpcs::{DictionaryItemIdentifier, GlobalStateIdentifier};
use crate::rpcs::DictionaryItemIdentifier;

/// Error that can be returned by the `cli` API.
#[derive(Error, Debug)]
Expand Down Expand Up @@ -134,7 +134,7 @@
error: casper_types::DigestError,
},

/// Failed to create a [`GlobalStateIdentifier`].

Check warning on line 137 in lib/cli/error.rs

View workflow job for this annotation

GitHub Actions / build_and_test (ubuntu-22.04)

unresolved link to `GlobalStateIdentifier`
#[error("failed to parse state identifier")]
FailedToParseStateIdentifier,

Expand Down
4 changes: 4 additions & 0 deletions lib/cli/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,10 @@ pub(super) fn global_state_identifier(
maybe_block_id: &str,
maybe_state_root_hash: &str,
) -> Result<Option<GlobalStateIdentifier>, CliError> {
if maybe_state_root_hash.is_empty() && maybe_block_id.is_empty() {
return Ok(None);
}

match block_identifier(maybe_block_id)? {
Some(BlockIdentifier::Hash(hash)) => {
return Ok(Some(GlobalStateIdentifier::BlockHash(hash)))
Expand Down
2 changes: 1 addition & 1 deletion lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ pub async fn query_global_state(
rpc_id: JsonRpcId,
node_address: &str,
verbosity: Verbosity,
global_state_identifier: GlobalStateIdentifier,
global_state_identifier: Option<GlobalStateIdentifier>,
key: Key,
path: Vec<String>,
) -> Result<SuccessResponse<QueryGlobalStateResult>, Error> {
Expand Down
1 change: 0 additions & 1 deletion lib/rpcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ pub use v2_0_0::{
get_entity::{AddressableEntity, EntityIdentifier, EntityOrAccount},
get_reward::EraIdentifier,
query_balance::PurseIdentifier,
query_global_state::GlobalStateIdentifier,
};
9 changes: 1 addition & 8 deletions lib/rpcs/v1_5_0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,4 @@ pub(crate) mod put_deploy {
pub(crate) use crate::rpcs::v1_4_5::put_deploy::{PutDeployParams, PUT_DEPLOY_METHOD};
}

pub(crate) mod query_global_state {
pub use crate::rpcs::v1_4_5::query_global_state::{
GlobalStateIdentifier, QueryGlobalStateResult,
};
pub(crate) use crate::rpcs::v1_4_5::query_global_state::{
QueryGlobalStateParams, QUERY_GLOBAL_STATE_METHOD,
};
}
pub(crate) mod query_global_state {}
12 changes: 2 additions & 10 deletions lib/rpcs/v1_6_0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

pub(crate) mod get_account;

// The following RPCs are all unchanged from v1.5.0, so we just re-export them.
pub mod query_global_state;

// The following RPCs are all unchanged from v1.5.0, so we just re-export them.
pub(crate) mod get_chainspec {
pub use crate::rpcs::v1_5_0::get_chainspec::GetChainspecResult;
pub(crate) use crate::rpcs::v1_5_0::get_chainspec::GET_CHAINSPEC_METHOD;
Expand Down Expand Up @@ -109,12 +110,3 @@ pub(crate) mod put_deploy {
pub use crate::rpcs::v1_5_0::put_deploy::PutDeployResult;
pub(crate) use crate::rpcs::v1_5_0::put_deploy::{PutDeployParams, PUT_DEPLOY_METHOD};
}

pub(crate) mod query_global_state {
pub use crate::rpcs::v1_5_0::query_global_state::{
GlobalStateIdentifier, QueryGlobalStateResult,
};
pub(crate) use crate::rpcs::v1_5_0::query_global_state::{
QueryGlobalStateParams, QUERY_GLOBAL_STATE_METHOD,
};
}
7 changes: 2 additions & 5 deletions lib/rpcs/v1_6_0/query_global_state.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use serde::{Deserialize, Serialize};

use casper_types::{Key, ProtocolVersion};
use casper_types::{BlockHeader, Key, ProtocolVersion, StoredValue};

use crate::rpcs::common::GlobalStateIdentifier;
pub(crate) use crate::rpcs::v1_4_5::query_global_state::QUERY_GLOBAL_STATE_METHOD;
use crate::{
rpcs::common::GlobalStateIdentifier,
types::{BlockHeader, StoredValue},
};

#[cfg(doc)]
use crate::BlockIdentifier;
Expand Down
7 changes: 3 additions & 4 deletions lib/rpcs/v2_0_0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ pub(crate) mod put_deploy {
pub(crate) use crate::rpcs::v1_6_0::put_deploy::{PutDeployParams, PUT_DEPLOY_METHOD};
}

pub(crate) mod query_global_state {
pub use crate::rpcs::v1_6_0::query_global_state::{
GlobalStateIdentifier, QueryGlobalStateResult,
};
pub mod query_global_state {
pub(crate) use crate::rpcs::v1_6_0::query_global_state::{
QueryGlobalStateParams, QUERY_GLOBAL_STATE_METHOD,
};

pub use crate::rpcs::v1_6_0::query_global_state::QueryGlobalStateResult;
}
2 changes: 1 addition & 1 deletion lib/rpcs/v2_0_0/query_balance_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};

use casper_types::{BlockTime, ProtocolVersion, U512};

use crate::rpcs::{GlobalStateIdentifier, PurseIdentifier};
use crate::rpcs::{common::GlobalStateIdentifier, PurseIdentifier};

pub(crate) const QUERY_BALANCE_DETAILS_METHOD: &str = "query_balance_details";

Expand Down
6 changes: 0 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ mod query_balance;
mod query_balance_details;
mod query_global_state;
mod transaction;
mod verify_contract;

use std::process;

Expand Down Expand Up @@ -61,8 +60,6 @@ use query_global_state::QueryGlobalState;
use transaction::{
ListTransactions, MakeTransaction, PutTransaction, SendTransaction, SignTransaction,
};
use verify_contract::VerifyContract;

const APP_NAME: &str = "Casper client";

static VERSION: Lazy<String> =
Expand Down Expand Up @@ -117,7 +114,6 @@ enum DisplayOrder {
Keygen,
AccountAddress,
GenerateCompletion,
VerifyContract,
}

fn cli() -> Command {
Expand Down Expand Up @@ -182,7 +178,6 @@ fn cli() -> Command {
.subcommand(GenerateCompletion::build(
DisplayOrder::GenerateCompletion as usize,
))
.subcommand(VerifyContract::build(DisplayOrder::VerifyContract as usize))
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -231,7 +226,6 @@ async fn main() {
Keygen::NAME => Keygen::run(matches).await,
AccountAddress::NAME => AccountAddress::run(matches).await,
GenerateCompletion::NAME => GenerateCompletion::run(matches).await,
VerifyContract::NAME => VerifyContract::run(matches).await,
_ => {
let _ = cli().print_long_help();
println!();
Expand Down
103 changes: 0 additions & 103 deletions src/verify_contract.rs

This file was deleted.

Loading