Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

add enable / disable / status methods for z coins #395

Merged
merged 17 commits into from
Jan 10, 2023
Merged

add enable / disable / status methods for z coins #395

merged 17 commits into from
Jan 10, 2023

Conversation

smk762
Copy link
Contributor

@smk762 smk762 commented Sep 12, 2022

closes #391

  • Enabling
  • Withdraw
  • Sidebar entries
    Converted to draft until updated method names are merged in API repo.

@smk762 smk762 marked this pull request as draft September 12, 2022 09:40
@smk762 smk762 marked this pull request as ready for review November 10, 2022 09:54
Copy link
Member

@laruh laruh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
I have one note

| ----------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ticker | string | Ticker of coin to activate |
| activation_params | object | List of [Electrum servers](https://github.com/KomodoPlatform/coins/tree/master/electrums) |
| activation_params.mode.zcash_params_path | string | Optional. Path to folder containing [Zcash parameters](https://z.cash/technology/paramgen/). Defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should provide a description of zcash_params_path after activation_params.mode, as its optional parameter and its not a part of mode. zcash_params_path is one of activation_params arguments.
You can expand the view till activation_params here
In addition, you can see, how zcoin activation params look in API code

pub struct ZcoinActivationParams {
    pub mode: ZcoinRpcMode,
    pub required_confirmations: Option<u64>,
    pub requires_notarization: Option<bool>,
    pub zcash_params_path: Option<String>,
}

Where ZcoinRpcModecould be Native or Light with electrum_servers and with light_wallet_d_servers.

@smk762 smk762 requested review from laruh, tonymorony and SirSevenG and removed request for laruh December 6, 2022 06:49
@smk762 smk762 requested a review from laruh December 13, 2022 08:32
Copy link
Member

@laruh laruh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes!
Next review iteration :)

## task::enable_z_coin::init

Z coins, like Pirate (ARRR) and the test coin ZOMBIE take a little longer to enable, and use a new two step method to enable. Activation can take a little while the first time, as we need to download some block cache data, and build a wallet database. Subsequent enabling will be faster, but still take a bit longer than other coins. The second step for activation is optional, but allows us to check the status of the activation process.
<b>To enable Z coins you also need to [install some Zcash Params](https://forum.komodoplatform.com/t/installing-zcash-params/603)</b>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you, please, add additional links to alternative fetch-params-alt scripts in your guide?
I had situations that some files from https://z.cash/downloads were unavailable, so I had Failed to fetch the Zcash zkSNARK parameters! error.
You left the link to zcutil with all scripts, but I think some users may not notice the alternative scripts in the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 18 to 20
| ..rpc_data.electrum_servers.protocol | string | Transport protocol used by AtomicDEX API to connect to the electrum server (`TCP` or `SSL`). Optional, defaults to `TCP` |
| ..rpc_data.electrum_servers.urls | string | Urls which are hosting electrum servers |
| ...electrum_servers.disable_cert_verification | boolean | If `true`, this disables server SSL/TLS certificate verification (e.g. to use self-signed certificate). <b>Use at your own risk</b> |
Copy link
Member

@laruh laruh Dec 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont have urls in electrum_servers.
We have list of ElectrumRpcRequest with parameters: url(one string), protocol and disable_cert_verification. ElectrumRpcRequest is structure in our code, we dont use its name in curl, we just use arguments of this structure in curly brackets.

If user wants to use one url and put true in disable_cert_verification, list will look like:
\"electrum_servers\": [{\"url\":\"zombie.sirseven.me:10033\", \"disable_cert_verification\":true}],.

Several urls in electrum_servers will look like:
\"electrum_servers\": [{\"url\":\"zombie.sirseven.me:10033\"}, {\"url\":\"zombie.sirseven.me:10034\"}],.

So basically electrum_servers has one parameter, which is a list of {url, protocol, disable_cert_verification}

@artemii235 am I right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the table, thanks for pointing it out.

@smk762
Copy link
Contributor Author

smk762 commented Jan 4, 2023

closes #391

@smk762 smk762 requested review from laruh and Canialon and removed request for laruh January 4, 2023 07:43
@smk762 smk762 requested a review from laruh January 4, 2023 07:44
\"method\": \"task::enable_z_coin::status\",
\"mmrpc\": \"2.0\",
\"params\": {
\"task_id\": $1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"task_id": $1,
Missing comma here and extra trailing one below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks,fixed.

@smk762 smk762 requested review from SirSevenG and laruh and removed request for laruh January 4, 2023 10:37
Copy link
Member

@laruh laruh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes!
Next review iteration. I have couple notes and one question :)

| ..rpc_data.electrum_servers | list of objects | Contains additional details about a coins electrum servers. |
| ...electrum_servers.protocol | string | Transport protocol used by AtomicDEX API to connect to the electrum server (`TCP` or `SSL`). Optional, defaults to `TCP` |
| ...electrum_servers.url | string | The URL and port of an electrum server |
| ...electrum_servers.disable_cert_verification | boolean | If `true`, this disables server SSL/TLS certificate verification (e.g. to use self-signed certificate). <b>Use at your own risk</b> |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add note for disable_cert_verification: Optional, defaults to false
:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -0,0 +1,63 @@
# withdraw_init

The `withdraw_init` method generates, signs, and returns a transaction that transfers the `amount` of `coin` to the address indicated in the `to` argument. It is only used for z coins like ZOMBIE, which may take some time to complete. The status of this method can be queried via the [withdraw_status](withdraw_status.html) method, or cancelled with [withdraw_status](withdraw_cancel.html).
Copy link
Member

@laruh laruh Jan 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. typo cancelled with [withdraw_status](withdraw_cancel.html). - I think this should be cancelled with [withdraw_cancel](withdraw_cancel.html).

  2. Could you tell me am I right or wrong? Right now links for withdraw_status and withdraw_cancel are invalid. They lead to our github docs project pages. But when this branch will be merged into master, links with withdraw_status.html and withdraw_cancel.html will exist, so everything will be fine.

  3. It is only used for z coins like ZOMBIE - as I can see in our code the method task::withdraw::init is used not only for ZCoin, but also for UtxoCoin, QtumCoin. In the case of other coins there will be an error CoinDoesntSupportInitWithdraw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I've reflowed these docs into two separate docs with subsections, and the sidebar accordingly
image
image
Any z coin specific text was removed from the withdraw tasks doc, with the z coin doc noting that the withdraw tasks are required for those coins and a link to the withdraw task doc.

The links will work once deployed (you can build & test locally to confirm. They don't work in github because the md / html extension change when built.

| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` |
| max | bool | withdraw the maximum available amount |
| fee.type | string | type of transaction fee; possible values: `UtxoFixed` or `UtxoPerKbyte` |
| fee.amount | string (numeric) | fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have arguments memo (optional and should be used carefully, as Artem suggested), and from (optional). As I can see, we use from for WithdrawRequest in trezor integration, in the case of Iguana there will be an error 'from' is not supported if the coin is initialized with an Iguana private key

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ain't 100% sure, but memo sounds like tendermint-only thing here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ain't 100% sure, but memo sounds like tendermint-only thing here.

We merged the PR related to memo use in ARRR withdraw KomodoPlatform/komodo-defi-framework#1574

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memo tested with ARR successfully (tho not seen in tx_history output as "error_type":"NotSupportedFor","error_data":"ARRR")
Added to the doc along with example to satisfy KomodoPlatform/komodo-defi-framework#1589 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tho not seen in tx_history output as "error_type":"NotSupportedFor","error_data":"ARRR"

Yep, thats correct, my_tx_history_v2_rpc now works only for Bch, SlpToken, UtxoCoin, QtumCoin, Tendermint and TendermintToken

@smk762 smk762 requested a review from laruh January 7, 2023 07:54
@smk762 smk762 mentioned this pull request Jan 7, 2023
14 tasks
| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` |
| memo | string | Optional, used for ZHTLC and Tendermint coins only. Attaches a memo to the transaction. |
| from | string | Optional, used only for transactions using a hardware wallet. For more information, see the [Trezor Integration guide](trezor_integration.html) |
| max | bool | withdraw the maximum available amount |
Copy link
Member

@laruh laruh Jan 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add Optional, defaults to false for max.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

| memo | string | Optional, used for ZHTLC and Tendermint coins only. Attaches a memo to the transaction. |
| from | string | Optional, used only for transactions using a hardware wallet. For more information, see the [Trezor Integration guide](trezor_integration.html) |
| max | bool | withdraw the maximum available amount |
| fee.type | string | type of transaction fee; possible values: `UtxoFixed` or `UtxoPerKbyte` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fee param is Optional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` |
| max | bool | withdraw the maximum available amount |
| fee.type | string | type of transaction fee; possible values: `UtxoFixed` or `UtxoPerKbyte` |
| fee.amount | string (numeric) | fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tho not seen in tx_history output as "error_type":"NotSupportedFor","error_data":"ARRR"

Yep, thats correct, my_tx_history_v2_rpc now works only for Bch, SlpToken, UtxoCoin, QtumCoin, Tendermint and TendermintToken

@smk762 smk762 requested a review from laruh January 9, 2023 08:27
Copy link
Member

@laruh laruh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!
Couple more non critical notes

upd: I see everything is done :D

@smk762 smk762 requested a review from laruh January 9, 2023 11:07
Copy link
Contributor

@SirSevenG SirSevenG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@laruh laruh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🔥

@smk762 smk762 merged commit 1ab1544 into master Jan 10, 2023
@smk762 smk762 deleted the zhtlc_docs branch January 10, 2023 11:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add docs for activating ZHTLC coins
5 participants