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

feat: tx sign --sign-with-lab #1604

Merged
merged 58 commits into from
Sep 25, 2024
Merged

feat: tx sign --sign-with-lab #1604

merged 58 commits into from
Sep 25, 2024

Conversation

elizabethengelman
Copy link
Contributor

@elizabethengelman elizabethengelman commented Sep 13, 2024

This branch is based on #1590.

Companion Lab PR: stellar/laboratory#987 (merged)

old pr: #1579

What

Closes #1428

This PR adds the ability to sign a tx via lab, by opening lab in the browser with the xdr prefilled in the Lab UI.

To test, on this branch, run:

  • you can generate your tx xdr, but this example uses xdr created from deploying the test_hello_world contract.
    (stellar contract deploy --wasm target/wasm32-unknown-unknown/test-wasms/test_hello_world.wasm --build-only --network testnet --source testnet-alice)
  • run the following from the root dir of this project, on this branch:
echo AAAAAgAAAADcOHnq5sGLOngOCEMyLqqn5CvFV2HGbOSjJAIzhqBdkAAAAGQAEb7UAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAQAAAAAAAAAAAAAAANw4eermwYs6eA4IQzIuqqfkK8VXYcZs5KMkAjOGoF2Q04SY/PMseMCgfbEFkX5gTr9qD/d0mvD9H3acFOz/X5oAAAAALtGgcgsAibk5q8VOLY2R1G1NdGX7fLzlz7iBFBy64JIAAAAAAAAAAAAAAAA= \
| cargo run tx sign --network testnet \
--sign-with-lab \
--lab-url http://laboratory-pr987.previews.kube001.services.stellar-ops.com/transaction/sign

Why

This will allow for another way for users to sign their tx.

Known limitations

  • Based on discussions during our weekly check-in, this PR is the first step in implementing this feature. For now, when the user adds the --sign-with-lab flag, the CLI will send the transaction's xdr to lab via a query param, and then will print out the xdr to the stdout.

    In future iterations, we may want to send the signed tx xdr back to the command line, but for now the intention is to have the user either:
    a. send the transaction from lab
    b. manually copy the signed xdr from Lab, and paste it back in the command line to use with the cli

  • Instead of having the flag be --sign-with-lab, what if we change it to --sign-externally? This would open us up to allow a user to pass in any URL that accepts xdr and networkPasshrase as query params. 🤔

willemneal and others added 16 commits September 10, 2024 15:25
The new `sign` subcommand allows for signing a passed transaction envelope. And can choose a different source_account than the signing key's corresponding public key.

Additionally, `signer::{Transaction, TransactionHash, Blob}` traits which simplifies the interface. Using blanket implementations, any type that implements `Blob`, will implement, `TransactionHash` and any type that implements `TransactionHash` implements `Transaction`, which uses the hash. This will allow for types to opt in to how they want to sign the transaction.
This was referenced Sep 13, 2024
@leighmcculloch leighmcculloch changed the title Feat/sign with lab feat: tx sign --sign-with-lab Sep 24, 2024
Base automatically changed from feat/tx_sign to main September 24, 2024 02:37
Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

I merged main into this PR to update it.

Some comments below.

cmd/soroban-cli/src/config/sign_with.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/config/sign_with.rs Outdated Show resolved Hide resolved
@leighmcculloch leighmcculloch enabled auto-merge (squash) September 25, 2024 02:12
@leighmcculloch leighmcculloch enabled auto-merge (squash) September 25, 2024 02:51
@leighmcculloch leighmcculloch merged commit 3c5cc83 into main Sep 25, 2024
25 checks passed
@leighmcculloch leighmcculloch deleted the feat/sign_with_lab branch September 25, 2024 02:54
printer.globeln(format!("Opening lab to sign transaction: {url}"));
open::that(url)?;

Err(Error::ReturningSignatureFromLab)
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future it'd be good to add a TODO with a task number in the code

@willemneal willemneal linked an issue Oct 2, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add a tx sign command Enable the CLI to generate links or files compatible with the Stellar Lab
4 participants