From 7290743e6b43f6de410d1f6c77c5060c11e65353 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 5 Jul 2023 14:10:00 +0300 Subject: [PATCH 1/4] show expected and actual token ids in pool box check; --- core/src/contracts/pool.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/contracts/pool.rs b/core/src/contracts/pool.rs index 213f5cd5..c815482f 100644 --- a/core/src/contracts/pool.rs +++ b/core/src/contracts/pool.rs @@ -23,8 +23,8 @@ pub struct PoolContract { pub enum PoolContractError { #[error("pool contract: parameter error: {0}")] ParametersError(#[from] PoolContractParametersError), - #[error("pool contract: unknown refresh NFT in box")] - UnknownRefreshNftId, + #[error("pool contract: unknown refresh NFT in box: expected {expected}, actual {actual}")] + UnknownRefreshNftId { expected: String, actual: String }, #[error("pool contract: unknown update NFT in box")] UnknownUpdateNftId, #[error("pool contract: sigma parsing error {0}")] @@ -129,7 +129,10 @@ impl PoolContract { ))? .try_extract_into::()?; if refresh_nft_token_id != inputs.refresh_nft_token_id.token_id() { - return Err(PoolContractError::UnknownRefreshNftId); + return Err(PoolContractError::UnknownRefreshNftId { + expected: inputs.refresh_nft_token_id.token_id().into(), + actual: refresh_nft_token_id.into(), + }); } let update_nft_token_id = ergo_tree From fc141ddcb07b8eee385562549b757aa309e1e43f Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 6 Jul 2023 18:10:20 +0300 Subject: [PATCH 2/4] add comment; --- core/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main.rs b/core/src/main.rs index 6a5b214b..4b8db535 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -491,6 +491,7 @@ fn handle_pool_command(command: Command, node_api: &NodeApi, network_prefix: Net } } Command::ImportPoolUpdate { pool_config_file } => { + /// TODO: check that update-pool called before this (pool box should not be found?). if let Err(e) = cli_commands::import_pool_update::import_pool_update( pool_config_file, &POOL_CONFIG.token_ids.oracle_token_id, From 2e510f938aa82f83e2cd0aaaabc2de77f1763225 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 7 Jul 2023 12:18:51 +0300 Subject: [PATCH 3/4] check for pool box before running import-pool-update command; --- core/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main.rs b/core/src/main.rs index 4b8db535..bd9d9a36 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -491,7 +491,10 @@ fn handle_pool_command(command: Command, node_api: &NodeApi, network_prefix: Net } } Command::ImportPoolUpdate { pool_config_file } => { - /// TODO: check that update-pool called before this (pool box should not be found?). + if op.get_pool_box_source().get_pool_box().is_ok() { + error!("Seems like update-pool is not called yet(pool box is found)."); + std::process::exit(exitcode::SOFTWARE); + } if let Err(e) = cli_commands::import_pool_update::import_pool_update( pool_config_file, &POOL_CONFIG.token_ids.oracle_token_id, From 14d658b0f6d7923b4c0cb69bdacd734486ebfa55 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 7 Jul 2023 15:51:10 +0300 Subject: [PATCH 4/4] change error message wording for update-pool command missing; --- core/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main.rs b/core/src/main.rs index bd9d9a36..26a4ca33 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -492,7 +492,7 @@ fn handle_pool_command(command: Command, node_api: &NodeApi, network_prefix: Net } Command::ImportPoolUpdate { pool_config_file } => { if op.get_pool_box_source().get_pool_box().is_ok() { - error!("Seems like update-pool is not called yet(pool box is found)."); + error!("Seems like update-pool command is missing (pool box is found)."); std::process::exit(exitcode::SOFTWARE); } if let Err(e) = cli_commands::import_pool_update::import_pool_update(