diff --git a/cli/src/config.rs b/cli/src/config.rs index 11ea896..ac7fa79 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -83,3 +83,9 @@ impl Default for Config { } } } + +impl AsRef for Config { + fn as_ref(&self) -> &Config { + self + } +} diff --git a/cli/src/handler.rs b/cli/src/handler.rs index edc9a62..3165da2 100644 --- a/cli/src/handler.rs +++ b/cli/src/handler.rs @@ -16,7 +16,10 @@ pub trait Handler { type Error; type Response; - async fn handle(self, config: Config) -> Result; + async fn handle + Send>( + self, + config: C, + ) -> Result; } #[async_trait] @@ -24,7 +27,10 @@ impl Handler for Request { type Error = Error; type Response = Response; - async fn handle(self, config: Config) -> Result { + async fn handle + Send>( + self, + config: C, + ) -> Result { match self { Request::Init(request) => request.handle(config).await, Request::Handshake(request) => request.handle(config).await, diff --git a/cli/src/handler/contract_build.rs b/cli/src/handler/contract_build.rs index d046562..6c82e7c 100644 --- a/cli/src/handler/contract_build.rs +++ b/cli/src/handler/contract_build.rs @@ -16,7 +16,12 @@ impl Handler for ContractBuildRequest { type Error = Error; type Response = Response; - async fn handle(self, config: Config) -> Result { + async fn handle + Send>( + self, + config: C, + ) -> Result { + let config = config.as_ref(); + let mut cargo = Command::new("cargo"); let command = cargo .arg("wasm") diff --git a/cli/src/handler/contract_deploy.rs b/cli/src/handler/contract_deploy.rs index ac9cad3..9aca804 100644 --- a/cli/src/handler/contract_deploy.rs +++ b/cli/src/handler/contract_deploy.rs @@ -29,7 +29,12 @@ impl Handler for ContractDeployRequest { type Error = Error; type Response = Response; - async fn handle(self, config: Config) -> Result { + async fn handle + Send>( + self, + config: C, + ) -> Result { + let config = config.as_ref(); + trace!("initializing directory structure..."); let (code_id, contract_addr) = if config.mock_sgx { @@ -52,7 +57,7 @@ impl Handler for ContractDeployRequest { async fn deploy( args: ContractDeployRequest, - config: Config, + config: &Config, ) -> Result<(u64, String), anyhow::Error> { // TODO: Replace with call to Rust package let relay_path = current_dir()?.join("../"); @@ -74,7 +79,7 @@ async fn deploy( let res = block_tx_commit(&tmrpc_client, deploy_output.txhash).await?; let log: Vec = serde_json::from_str(&res.tx_result.log)?; - let code_id: usize = log[0].events[1].attributes[1].value.parse()?; + let code_id: u64 = log[0].events[1].attributes[1].value.parse()?; info!("\nšŸš€ Communicating with Relay to Instantiate...\n"); let raw_init_msg = run_relay::>( @@ -106,7 +111,7 @@ async fn deploy( debug!("{contract_addr}"); - Ok((code_id as u64, contract_addr.to_owned())) + Ok((code_id, contract_addr.to_owned())) } //RES=$($CMD tx wasm instantiate "$CODE_ID" "$INSTANTIATE_MSG" --from "$USER_ADDR" --label $LABEL $TXFLAG -y --no-admin --output json) diff --git a/cli/src/handler/enclave_build.rs b/cli/src/handler/enclave_build.rs index 451e689..b6875a3 100644 --- a/cli/src/handler/enclave_build.rs +++ b/cli/src/handler/enclave_build.rs @@ -16,7 +16,12 @@ impl Handler for EnclaveBuildRequest { type Error = Error; type Response = Response; - async fn handle(self, config: Config) -> Result { + async fn handle + Send>( + self, + config: C, + ) -> Result { + let config = config.as_ref(); + let mut cargo = Command::new("cargo"); let command = cargo .args(["build", "--release"]) diff --git a/cli/src/handler/enclave_start.rs b/cli/src/handler/enclave_start.rs index 4a4c9ae..36fa8b1 100644 --- a/cli/src/handler/enclave_start.rs +++ b/cli/src/handler/enclave_start.rs @@ -17,7 +17,11 @@ impl Handler for EnclaveStartRequest { type Error = Error; type Response = Response; - async fn handle(self, mut config: Config) -> Result { + async fn handle + Send>( + self, + config: C, + ) -> Result { + let mut config = config.as_ref().clone(); // Get trusted height and hash let (trusted_height, trusted_hash) = get_hash_height(self.use_latest_trusted, &mut config)?; diff --git a/cli/src/handler/handshake.rs b/cli/src/handler/handshake.rs index 0f67ecd..c5c1706 100644 --- a/cli/src/handler/handshake.rs +++ b/cli/src/handler/handshake.rs @@ -32,7 +32,12 @@ impl Handler for HandshakeRequest { type Error = Error; type Response = Response; - async fn handle(self, config: Config) -> Result { + async fn handle + Send>( + self, + config: C, + ) -> Result { + let config = config.as_ref().clone(); + trace!("starting handshake..."); // TODO: may need to import verbosity here diff --git a/cli/src/handler/init.rs b/cli/src/handler/init.rs index ea81f8d..54e9769 100644 --- a/cli/src/handler/init.rs +++ b/cli/src/handler/init.rs @@ -18,7 +18,12 @@ impl Handler for InitRequest { type Error = Error; type Response = Response; - async fn handle(self, config: Config) -> Result { + async fn handle + Send>( + self, + config: C, + ) -> Result { + let config = config.as_ref(); + trace!("initializing directory structure..."); let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".."); diff --git a/cosmwasm/packages/tcbinfo/src/contract.rs b/cosmwasm/packages/tcbinfo/src/contract.rs index 6e98634..9e07d3c 100644 --- a/cosmwasm/packages/tcbinfo/src/contract.rs +++ b/cosmwasm/packages/tcbinfo/src/contract.rs @@ -5,7 +5,7 @@ use cosmwasm_std::{ }; use cw2::set_contract_version; use der::{DateTime, DecodePem}; -use mc_attestation_verifier::{CertificateChainVerifier, SignedTcbInfo, TcbInfo as McTcbInfo}; +use mc_attestation_verifier::{CertificateChainVerifier, SignedTcbInfo}; use p256::ecdsa::VerifyingKey; use quartz_tee_ra::intel_sgx::dcap::certificate_chain::TlsCertificateChainVerifier; use serde_json::Value; diff --git a/utils/cycles-sync/src/wasmd_client.rs b/utils/cycles-sync/src/wasmd_client.rs index 2329aeb..4010ee0 100644 --- a/utils/cycles-sync/src/wasmd_client.rs +++ b/utils/cycles-sync/src/wasmd_client.rs @@ -47,7 +47,7 @@ pub trait WasmdClient { &self, chain_id: &Id, sender: &str, - code_id: usize, + code_id: u64, init_msg: M, label: &str, ) -> Result; @@ -201,7 +201,7 @@ impl WasmdClient for CliWasmdClient { &self, chain_id: &Id, sender: &str, - code_id: usize, + code_id: u64, init_msg: M, label: &str, ) -> Result {