fix: cargo-install --path cli (#200)

Co-authored-by: dusterbloom <32869278+dusterbloom@users.noreply.github.com>
This commit is contained in:
Shoaib Ahmed 2024-09-13 17:28:32 +04:00 committed by GitHub
parent 7526d78299
commit 43a1a49c3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 201 additions and 208 deletions

372
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -36,7 +36,7 @@ hex = { version = "0.4.3", default-features = false }
hex-literal = { version = "0.4.1", default-features = false }
k256 = { version = "0.13.2", default-features = false, features = ["ecdsa", "alloc"] }
num-bigint = { version = "0.4.4", default-features = false }
prost = { version = "=0.13.1", default-features = false }
prost = { version = "0.13.1", default-features = false }
rand = { version = "0.8.5", default-features = false, features = ["getrandom"] }
rand_core = { version = "0.6", default-features = false, features = ["std"] }
reqwest = { version = "0.12.2", default-features = false, features = ["json", "rustls-tls"] }

View file

@ -1,11 +1,9 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RunClearingRequest {
#[prost(string, tag = "1")]
pub message: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RunClearingResponse {
#[prost(string, tag = "1")]

View file

@ -106,7 +106,7 @@ pub struct HandshakeArgs {
/// Fetch latest trusted hash and height from the chain instead of existing configuration
#[arg(long)]
pub use_latest_trusted: bool,
pub unsafe_trust_latest: bool,
/// Name or address of private key with which to sign
#[arg(long)]
@ -188,7 +188,7 @@ pub struct EnclaveStartArgs {
/// Fetch latest trusted hash and height from the chain instead of existing configuration
#[arg(long)]
pub use_latest_trusted: bool,
pub unsafe_trust_latest: bool,
/// Whether to target release or dev
#[arg(long)]
@ -204,7 +204,7 @@ pub struct DevArgs {
/// Fetch latest trusted hash and height from the chain instead of existing configuration
#[arg(long)]
pub use_latest_trusted: bool,
pub unsafe_trust_latest: bool,
#[command(flatten)]
pub contract_deploy: ContractDeployArgs,

View file

@ -1,4 +1,4 @@
use std::{env, path::PathBuf};
use std::path::PathBuf;
use cosmrs::tendermint::chain::Id as ChainId;
use serde::{Deserialize, Serialize};

View file

@ -211,7 +211,7 @@ async fn spawn_enclave_start(
let (shutdown_tx, shutdown_rx) = watch::channel(());
let enclave_start = EnclaveStartRequest {
shutdown_rx: Some(shutdown_rx),
use_latest_trusted: args.use_latest_trusted,
unsafe_trust_latest: args.unsafe_trust_latest,
};
let config_cpy = config.clone();
@ -281,7 +281,7 @@ async fn deploy_and_handshake(
info!("Running handshake on contract `{}`", contract);
let handshake = HandshakeRequest {
contract: wasmaddr_to_id(&contract).map_err(|_| Error::GenericErr(String::default()))?,
use_latest_trusted: args.use_latest_trusted,
unsafe_trust_latest: args.unsafe_trust_latest,
};
let h_res = handshake.handle(config).await;

View file

@ -35,14 +35,14 @@ impl TryFrom<Command> for Request {
Command::Init(args) => Ok(InitRequest { name: args.name }.try_into()?),
Command::Handshake(args) => Ok(HandshakeRequest {
contract: args.contract,
use_latest_trusted: args.use_latest_trusted,
unsafe_trust_latest: args.unsafe_trust_latest,
}
.into()),
Command::Contract { contract_command } => contract_command.try_into(),
Command::Enclave { enclave_command } => enclave_command.try_into(),
Command::Dev(args) => Ok(DevRequest {
watch: args.watch,
use_latest_trusted: args.use_latest_trusted,
unsafe_trust_latest: args.unsafe_trust_latest,
init_msg: serde_json::from_str(&args.contract_deploy.init_msg)
.map_err(|e| Error::GenericErr(e.to_string()))?,
label: args.contract_deploy.label,
@ -98,7 +98,7 @@ impl TryFrom<EnclaveCommand> for Request {
EnclaveCommand::Build(_) => Ok(EnclaveBuildRequest {}.into()),
EnclaveCommand::Start(args) => Ok(EnclaveStartRequest {
shutdown_rx: None,
use_latest_trusted: args.use_latest_trusted,
unsafe_trust_latest: args.unsafe_trust_latest,
}
.into()),
}

View file

@ -5,7 +5,7 @@ use crate::request::Request;
#[derive(Clone, Debug)]
pub struct DevRequest {
pub watch: bool,
pub use_latest_trusted: bool,
pub unsafe_trust_latest: bool,
pub init_msg: serde_json::Value,
pub label: String,
pub contract_manifest: PathBuf,

View file

@ -10,7 +10,7 @@ use crate::{
#[derive(Clone, Debug)]
pub struct EnclaveStartRequest {
pub shutdown_rx: Option<watch::Receiver<()>>,
pub use_latest_trusted: bool,
pub unsafe_trust_latest: bool,
}
impl From<EnclaveStartRequest> for Request {
@ -22,7 +22,8 @@ impl From<EnclaveStartRequest> for Request {
impl EnclaveStartRequest {
/// Returns the trusted hash and height
pub fn get_hash_height(&self, config: &Config) -> Result<(Height, Hash), Error> {
if self.use_latest_trusted || config.trusted_height == 0 || config.trusted_hash.is_empty() {
if self.unsafe_trust_latest || config.trusted_height == 0 || config.trusted_hash.is_empty()
{
debug!("querying latest trusted hash & height from node");
let (trusted_height, trusted_hash) = query_latest_height_hash(&config.node_url)?;

View file

@ -5,7 +5,7 @@ use crate::request::Request;
#[derive(Clone, Debug)]
pub struct HandshakeRequest {
pub contract: AccountId,
pub use_latest_trusted: bool,
pub unsafe_trust_latest: bool,
}
impl From<HandshakeRequest> for Request {

View file

@ -1,29 +1,23 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct InstantiateRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InstantiateResponse {
#[prost(string, tag = "1")]
pub message: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SessionCreateRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SessionCreateResponse {
#[prost(string, tag = "1")]
pub message: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SessionSetPubKeyRequest {
#[prost(string, tag = "1")]
pub message: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SessionSetPubKeyResponse {
#[prost(string, tag = "1")]