contract/deployooor/client: replaced asserts with error returns and added log targets

This commit is contained in:
skoupidi
2024-05-20 14:18:05 +03:00
parent 5c126999a1
commit 0fb90b0978
2 changed files with 10 additions and 5 deletions

View File

@@ -16,9 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use darkfi::Result;
use darkfi::{ClientFailed, Result};
use darkfi_sdk::{crypto::Keypair, deploy::DeployParamsV1};
use log::debug;
use log::{debug, error};
use crate::error::DeployError;
pub struct DeployCallDebris {
pub params: DeployParamsV1,
@@ -36,8 +38,11 @@ pub struct DeployCallBuilder {
impl DeployCallBuilder {
pub fn build(&self) -> Result<DeployCallDebris> {
debug!("Building Deployooor::DeployV1 contract call");
assert!(!self.wasm_bincode.is_empty());
debug!(target: "contract::deployooor::client::deploy", "Building Deployooor::DeployV1 contract call");
if self.wasm_bincode.is_empty() {
error!(target: "contract::deployooor::client::deploy", "Provided WASM bincode is empty");
return Err(ClientFailed::VerifyError(DeployError::WasmBincodeInvalid.to_string()).into())
}
let params = DeployParamsV1 {
wasm_bincode: self.wasm_bincode.clone(),

View File

@@ -34,7 +34,7 @@ pub struct LockCallBuilder {
impl LockCallBuilder {
pub fn build(&self) -> Result<LockCallDebris> {
debug!("Building Deployooor::LockV1 contract call");
debug!(target: "contract::deployooor::client::lock", "Building Deployooor::LockV1 contract call");
let params = LockParamsV1 { public_key: self.deploy_keypair.public };
let debris = LockCallDebris { params };