Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[r2r] Allow passing Zcash params file path to activation request #1538

Merged
merged 7 commits into from
Nov 10, 2022

Conversation

laruh
Copy link
Member

@laruh laruh commented Nov 9, 2022

related to ARRR integration. #927

Now we can pass zcash_params_path parameter to Zcoin activation request.

curl example with path param:

"{\"userpass\":\"${USERPASS}\",\"method\":\"task::enable_z_coin::init\",\"mmrpc\":\"2.0\",\"params\":{\"ticker\":\"ZOMBIE\",\"activation_params\":{\"mode\":{\"rpc\":\"Light\",\"rpc_data\":{\"electrum_servers\":[{\"url\":\"zombie.sirseven.me:10033\"}],\"light_wallet_d_servers\":[\"http://zombie.sirseven.me:443\",\"http://zombie.sirseven.me:1443\",\"http://zombie.sirseven.me:2443\"]}},\"zcash_params_path\":\"/home/user/TEST_PATH/.zcash-params\"}}}"

The tree example for easy reading looks like:

{
  "userpass": "${USERPASS}",
  "method": "task::enable_z_coin::init",
  "mmrpc": "2.0",
  "params": {
    "ticker": "ZOMBIE",
    "activation_params": {
      "mode": {
        "rpc": "Light",
        "rpc_data": {
          "electrum_servers": [
            {
              "url": "zombie.sirseven.me:10033"
            }
          ],
          "light_wallet_d_servers": [
            "http://zombie.sirseven.me:443",
            "http://zombie.sirseven.me:1443",
            "http://zombie.sirseven.me:2443"
          ]
        }
      },
      "zcash_params_path": "/home/user/TEST_PATH/.zcash-params"
    }
  }
}

Without the path parameter the default path will be used, which is home directory plus the name of zcash params folder in current OS. Like it was before this PR.

@laruh laruh requested a review from artemii235 November 9, 2022 13:46
Copy link
Member

@artemii235 artemii235 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 PR! One note.

Comment on lines 775 to 783
let (spend_path, output_path) = if path.exists() {
(path.join(SAPLING_SPEND_NAME), path.join(SAPLING_OUTPUT_NAME))
} else {
return MmError::err(ZCoinBuildError::ZCashParamsNotFound);
};
if !(spend_path.exists() && output_path.exists()) {
return MmError::err(ZCoinBuildError::ZCashParamsNotFound);
}
LocalTxProver::new(&spend_path, &output_path)
Copy link
Member

Choose a reason for hiding this comment

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

As there are FS operations and LocalTxProver::new can take significant time to load, please wrap this entire code block into async_blocking.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I see.
Done

Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

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

Great! @laruh Could you please provide examples for docs updates to @smk762?

@artemii235 artemii235 merged commit d5b542f into dev Nov 10, 2022
@artemii235 artemii235 deleted the passing_Zcash_params_file_path_to_request branch November 10, 2022 08:48
@smk762
Copy link

smk762 commented Nov 10, 2022

Thanks :)
Draft zhtlc docs updated accordingly at https://github.com/KomodoPlatform/developer-docs/pull/395/files

@laruh laruh mentioned this pull request Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants