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/ledger signing #1278

Merged
merged 87 commits into from
May 27, 2024
Merged

Feat/ledger signing #1278

merged 87 commits into from
May 27, 2024

Conversation

elizabethengelman
Copy link
Contributor

@elizabethengelman elizabethengelman commented Apr 3, 2024

What

Add support for signing transactions on a Ledger device.
#1178

Why

Work toward key protection when submitting txns from the CLI. (#1255)

Known limitations

This does not implement the full Stellar signer trait yet. The stellar app deployed on the ledger device does not yet support signing soroban auth entries yet, so in the mean time we will only be able to do hash signing for soroban tx.

Todo

so that is can use the ledger-transport::Exchange trait for the
transport which is async

using this trait allows us to use the Zemu transport which can connect
to the Speculos emulator
i needed to look at the js implementation again (hw-app-str) - they have
a note that says to pass the `signatureBase` into the `signTransaction`
fn. I had forgotten about this. The `signatureBase` fn is defined in
js-stellar-base and is the value that should be sent to the network. it
is TransactionSignaturePayload.toXDR(). Which is also in the signer
train and i didn't notice it. 🙈
Copy link
Member

@willemneal willemneal left a comment

Choose a reason for hiding this comment

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

Great work! Excited to finally get this out there!

@willemneal willemneal requested a review from chadoh May 23, 2024 15:49
Copy link
Contributor

@chadoh chadoh left a comment

Choose a reason for hiding this comment

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

🎉

Looks super well organized and documented. Really glad to be able to ship this!

@willemneal willemneal enabled auto-merge (squash) May 25, 2024 11:50
willemneal and others added 2 commits May 27, 2024 09:45
@willemneal willemneal merged commit 639be30 into stellar:main May 27, 2024
18 of 19 checks passed
impl ImageArgs for Args {
fn into_iterator(self) -> Box<dyn Iterator<Item = String>> {
let container_elf_path = format!("{DEFAULT_APP_PATH}/stellarNanosApp.elf");
let command_string = format!("/home/zondax/speculos/speculos.py --log-level speculos:DEBUG --color JADE_GREEN --display headless -s \"other base behind follow wet put glad muscle unlock sell income october\" -m nanos {container_elf_path}");
Copy link
Member

Choose a reason for hiding this comment

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

Is the speculos file only used during testing? What's the significance of this hardcoded 12-word passphrase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

speculos.rs is only used in testing - like I mentioned in the other comment, I'm thinking I should create a tests directory or something to put all test-only related files in there to make this more clear.

The hardcoded passphrase is the seed phrase for the account on the emulated device. It probably makes sense to pull this out into a constant.

I can make these changes in a follow-up PR!

Copy link
Member

Choose a reason for hiding this comment

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

Ah got it. Yup makes sense.

We've kept tests in other repos in a tests/test module. Rust doesn't require it, but keeping tests in a separate module reduces rebuilds, supposedly, in large rust projects, which is why we use that pattern in other repos. This repo isn't big enough to see any benefit of that though, so not something we need to do. But moving stuff like this only used by tests makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to close the loop, this PR makes this update: #1343

@willemneal willemneal deleted the feat/ledger-signing branch May 29, 2024 03:01
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.

None yet

4 participants