diff --git a/_QUICKSTART.md b/_QUICKSTART.md index 94d4b63..6f70c3c 100644 --- a/_QUICKSTART.md +++ b/_QUICKSTART.md @@ -132,8 +132,8 @@ scp -r $SOURCE root@$REMOTE_IP:$DESTINATION # UPDATE IF DIFFERS deploy.ts ```bash - docker exec -it secretdev secretcli tx bank send secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg 100000000000000000uscrt - y + docker exec -it secretdev secretcli tx bank send secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg 100000000000000000uscrt -y + docker exec -it secretdev secretcli query bank balances secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg | jq ``` @@ -162,8 +162,8 @@ scp -r $SOURCE root@$REMOTE_IP:$DESTINATION ``` ```bash - docker exec -it secretdev secretcli tx bank send secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg 100000000000000000uscrt - y + docker exec -it secretdev secretcli tx bank send secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg 100000000000000000uscrt -y + docker exec -it secretdev secretcli query bank balances secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg | jq ``` diff --git a/_SETUP.md b/_SETUP.md index 1a9c6b0..29fe71a 100644 --- a/_SETUP.md +++ b/_SETUP.md @@ -516,8 +516,8 @@ cd SecretPath/TNLS-Relayers * Note: We need the 300000uscrt to process the broadcast the `requestValue` transaction from the relayer, so give them more than that. * Note: If you forget to do this before running the relayer, then you might get error `[SCRT Interface: ERROR] Failed to fetch account info: HTTP 404` ``` - secretcli tx bank send secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg 100000000000000000uscrt - y + secretcli tx bank send secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg 100000000000000000uscrt -y + secretcli query bank balances secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg | jq ``` diff --git a/packages/secret-contracts-scripts/src/config/deploy.ts b/packages/secret-contracts-scripts/src/config/deploy.ts index a348317..43e5fe9 100644 --- a/packages/secret-contracts-scripts/src/config/deploy.ts +++ b/packages/secret-contracts-scripts/src/config/deploy.ts @@ -77,7 +77,7 @@ const config = { endpoint: process.env.ENDPOINT_LOCAL, secretNunya: { nunyaContractCodeId: "2", // only know after upload - nunyaContractCodeHash: "9cbd5742b70a5f6f94f93bc2a31f9c8e8b27c011d4782f18131e11e72ffe1655", // only know after upload + nunyaContractCodeHash: "37bf978b95a5fb3aa60799ab8be8be410d9da9cb291c40c3dc3e0d110a5fca66", // only know after upload nunyaContractAddress: "secret1gyruqan6yxf0q423t8z5zce3x7np35uw8s8wqc", // only know after instantiate nunyaContractWasmPath: "contract.wasm.gz", }, diff --git a/packages/secret-contracts/my-counter-contract/src/contract.rs b/packages/secret-contracts/my-counter-contract/src/contract.rs index 8da5323..83691e2 100644 --- a/packages/secret-contracts/my-counter-contract/src/contract.rs +++ b/packages/secret-contracts/my-counter-contract/src/contract.rs @@ -17,8 +17,7 @@ pub fn instantiate( owner: info.sender.clone(), }; - deps.api - .debug(format!("Contract was initialized by {}", info.sender).as_str()); + deps.api.debug(format!("Contract was initialized by {}", info.sender).as_str()); config(deps.storage).save(&state)?; Ok(Response::default()) diff --git a/packages/secret-contracts/nunya-contract/src/contract.rs b/packages/secret-contracts/nunya-contract/src/contract.rs index 65e45f3..a859232 100644 --- a/packages/secret-contracts/nunya-contract/src/contract.rs +++ b/packages/secret-contracts/nunya-contract/src/contract.rs @@ -44,13 +44,12 @@ pub fn instantiate( owner: info.sender.clone(), }; - eprintln!("instantiate"); - eprintln!("msg: {:#?}", msg.clone()); - eprintln!("info: {:#?}", info.clone()); - eprintln!("state: {:#?}", state.clone()); + deps.api.debug(format!("instantiate").as_str()); + deps.api.debug(format!("msg: {:#?}", msg.clone()).as_str()); + deps.api.debug(format!("info: {:#?}", info.clone()).as_str()); + deps.api.debug(format!("state: {:#?}", state.clone()).as_str()); - deps.api - .debug(format!("Contract was initialized by {}", info.sender).as_str()); + deps.api.debug(format!("Contract was initialized by {}", info.sender).as_str()); CONFIG.save(deps.storage, &state)?; @@ -96,9 +95,9 @@ fn try_handle( // verify signature with stored gateway public key let config = CONFIG.load(deps.storage)?; - eprintln!("try_handle"); - eprintln!("msg: {:#?}", msg.clone()); - eprintln!("info: {:#?}", info.clone()); + deps.api.debug(format!("try_handle").as_str()); + deps.api.debug(format!("msg: {:#?}", msg.clone()).as_str()); + deps.api.debug(format!("info: {:#?}", info.clone()).as_str()); // Security // @@ -119,6 +118,7 @@ fn try_handle( // )); // } + // FIXME: Generic error: Invalid public key format deps.api .secp256k1_verify( msg.input_hash.as_slice(), @@ -130,8 +130,8 @@ fn try_handle( // determine which function to call based on the included handle let handle = msg.handle.as_str(); - eprintln!("try_handle"); - eprintln!("handle: {:#?}", handle); + deps.api.debug(format!("try_handle").as_str()); + deps.api.debug(format!("handle: {:#?}", handle).as_str()); match handle { // TODO: change all below to snake_case if required for Gateway contract to be able to call. @@ -165,7 +165,7 @@ fn request_value( .map_err(|err| StdError::generic_err(err.to_string()))?; let my_arg = input.myArg; - eprintln!("request_value: input.myArg {:#?}", input.myArg); + deps.api.debug(format!("request_value: input.myArg {:#?}", input.myArg).as_str()); let response_status_code: ResponseStatusCode = 0u16; diff --git a/packages/secret-contracts/secret-gateway/src/contract.rs b/packages/secret-contracts/secret-gateway/src/contract.rs index 90c646a..1c7422e 100644 --- a/packages/secret-contracts/secret-gateway/src/contract.rs +++ b/packages/secret-contracts/secret-gateway/src/contract.rs @@ -67,9 +67,9 @@ pub fn instantiate( signing_keys: KeyPair::default(), }; - eprintln!("instantiate"); - eprintln!("msg: {:#?}", msg.clone()); - eprintln!("info: {:#?}", info.clone()); + deps.api.debug(format!("instantiate").as_str()); + deps.api.debug(format!("msg: {:#?}", msg.clone()).as_str()); + deps.api.debug(format!("info: {:#?}", info.clone()).as_str()); CONFIG.save(deps.storage, &state)?; @@ -90,9 +90,9 @@ pub fn instantiate( /// #[entry_point] pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> StdResult { - eprintln!("execute"); - eprintln!("msg: {:#?}", msg.clone()); - eprintln!("info: {:#?}", info.clone()); + deps.api.debug(format!("execute").as_str()); + deps.api.debug(format!("msg: {:#?}", msg.clone()).as_str()); + deps.api.debug(format!("info: {:#?}", info.clone()).as_str()); let response = match msg { ExecuteMsg::Input { inputs } => pre_execution(deps, env, inputs), @@ -115,10 +115,10 @@ fn rotate_gateway_keys(deps: DepsMut, env: Env, info: MessageInfo) -> StdResult< let caller_raw = deps.api.addr_canonicalize(info.sender.as_str())?; - eprintln!("rotate_gateway_keys"); - eprintln!("caller: {:#?}", caller_raw.clone()); - eprintln!("state: {:#?}", state.clone()); - eprintln!("info: {:#?}", info.clone()); + deps.api.debug(format!("rotate_gateway_keys").as_str()); + deps.api.debug(format!("caller: {:#?}", caller_raw.clone()).as_str()); + deps.api.debug(format!("state: {:#?}", state.clone()).as_str()); + deps.api.debug(format!("info: {:#?}", info.clone()).as_str()); // check if the keys have already been created if state.keyed { @@ -164,8 +164,8 @@ fn create_gateway_keys(deps: DepsMut, env: Env) -> StdResult { // load config let state = CONFIG.load(deps.storage)?; - eprintln!("create_gateway_keys"); - eprintln!("state: {:#?}", state.clone()); + deps.api.debug(format!("create_gateway_keys").as_str()); + deps.api.debug(format!("state: {:#?}", state.clone()).as_str()); // check if the keys have already been created if state.keyed { @@ -207,9 +207,9 @@ fn pre_execution(deps: DepsMut, _env: Env, msg: PreExecutionMsg) -> StdResult StdResult StdResult { - eprintln!("pre_execution"); - eprintln!("Verification failed: {:#?}", err); + deps.api.debug(format!("pre_execution").as_str()); + deps.api.debug(format!("Verification failed: {:#?}", err).as_str()); //return Err(StdError::generic_err(format!("Verification failed: {}", err))); // Continue with the decrypted payload if only verification fails @@ -267,8 +267,8 @@ fn pre_execution(deps: DepsMut, _env: Env, msg: PreExecutionMsg) -> StdResult { - eprintln!("pre_execution"); - eprintln!("Decryption failed: {:#?}", err); + deps.api.debug(format!("pre_execution").as_str()); + deps.api.debug(format!("Decryption failed: {:#?}", err).as_str()); //return Err(StdError::generic_err(format!("Decryption failed: {}", err))); // If decryption fails, continue with the original, encrypted payload // We are not verifying the payload in this case as it's already deemed unsafe @@ -276,24 +276,24 @@ fn pre_execution(deps: DepsMut, _env: Env, msg: PreExecutionMsg) -> StdResult StdResult StdResult StdResult StdResult