Skip to content

Support Ledger clear signing #1603

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

Open
wants to merge 40 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ffa255f
Update SHAs for ledger repos
franciszekjob May 12, 2025
27d2d66
Add blind-signing allowance script
franciszekjob May 12, 2025
4cd9c84
Implement clear signing
franciszekjob May 12, 2025
8494f0d
Add client fixture with predeclared argent accounts
franciszekjob May 12, 2025
f1d158a
Update tests and automation rules
franciszekjob May 12, 2025
0d254cc
update automation rules
franciszekjob May 12, 2025
b208ea6
Update `poetry.lock`
franciszekjob May 12, 2025
844f410
Fix typechecks
franciszekjob May 12, 2025
b7ad26c
Fir formatting
franciszekjob May 12, 2025
9022364
Update docs
franciszekjob May 12, 2025
ccdee97
Refactor call encoding
franciszekjob May 12, 2025
55e6042
Add docstrings for `LedgerSigningMode`
franciszekjob May 12, 2025
f90450e
Include `LedgerSigningMode` in docs
franciszekjob May 12, 2025
c94b837
Update migration guide
franciszekjob May 12, 2025
b4d2619
Fix linting
franciszekjob May 12, 2025
02bf3c4
Fix `Build the app inside Docker container` step
franciszekjob May 12, 2025
6a29cea
Fix typo
franciszekjob May 12, 2025
1d6a784
Update port
franciszekjob May 12, 2025
ad39434
Remove "Reject" automation rule
franciszekjob May 12, 2025
0cd5287
Fix automation rules
franciszekjob May 13, 2025
7e237e8
Formatting
franciszekjob May 13, 2025
95468d1
Update order of automation rules
franciszekjob May 13, 2025
80807cd
Trigger CI
franciszekjob May 13, 2025
b31777b
Temporarily skip `test_deploy_account_and_transfer`
franciszekjob May 13, 2025
6a285a6
Temporarily skip `test_create_account_with_ledger_signer`
franciszekjob May 13, 2025
c7fcf72
Temporarily skip rest of ledger tests
franciszekjob May 13, 2025
8164c03
Fix automation rules
franciszekjob May 13, 2025
b001bb4
Apply code review suggestions
franciszekjob May 15, 2025
d20ff65
Bump devnet
franciszekjob May 15, 2025
a8f8a9c
Merge branch 'development' of https://github.com/software-mansion/sta…
franciszekjob May 15, 2025
e518de7
Fix typo
franciszekjob May 15, 2025
bafe1a0
Always predeclare argent
franciszekjob May 15, 2025
37f7dc9
Revert "Always predeclare argent"
franciszekjob May 15, 2025
a38ba8f
Fix typo
franciszekjob May 15, 2025
740a8ec
Always predeclare argent accounts
franciszekjob May 15, 2025
9a02447
Fix linting
franciszekjob May 15, 2025
96eafcd
Apply code review suggestions
franciszekjob May 16, 2025
ec7a68e
Add `test_invoke_v3_long_calldata`
franciszekjob May 16, 2025
9cd1d5e
Apply code review suggestion
franciszekjob May 16, 2025
7dec2c5
Update automation rules
franciszekjob May 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Checks

env:
CAIRO_LANG_VERSION: "0.13.1"
DEVNET_SHA: fc5a2753a2eedcc27eed7a4fae3ecac08c2ca1b4
LEDGER_APP_SHA: db93a5e33d00bd44752fdc8c07aefcffa08d91c3
LEDGER_APP_DEV_TOOLS_SHA: a037d42181f4bed9694246256e2c9e2a899e775c302a9c6482c81f87c28e1432
DEVNET_SHA: 26292d1f92807090776b470f43b321f150f55ffd # v0.4.1
LEDGER_APP_SHA: 768a7b47b0da681b28112342edd76e2c9b292c4e # v2.3.1
LEDGER_APP_DEV_TOOLS_SHA: a845b2ab0b5dd824133f73858f6f373edea85ec1bd828245bf50ce9700f33bcb # v4.5.0

on:
push:
Expand Down Expand Up @@ -200,6 +200,7 @@ jobs:
run: |
cd /apps/app-starknet
git checkout ${{ env.LEDGER_APP_SHA }}
cd starknet
cargo clean
cargo ledger build nanox

Expand All @@ -219,6 +220,9 @@ jobs:
- name: Wait for Speculos to start
run: sleep 5

- name: Allow blind signing
run: ./starknet_py/tests/unit/signer/allow_ledger_blind_signing.sh

- name: Update automation rules
working-directory: starknet_py/tests/unit/signer
run: |
Expand Down
8 changes: 8 additions & 0 deletions docs/api/signer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@ To use LedgerSigner, you need to install starknetpy with `ledger` extra like thi
.. autoclass:: LedgerSigner
:members:
:member-order: groupwise

-----------------
LedgerSigningMode
-----------------

.. autoclass:: LedgerSigningMode
:members:
:member-order: groupwise
2 changes: 1 addition & 1 deletion docs/guide/signing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ signing algorithm, it is possible to create ``Account`` with custom
Signing with Ledger
-------------------
:ref:`LedgerSigner` allows you to sign transactions using a Ledger device. The device must be unlocked and Starknet app needs to be open.
Currently used version of Starknet app is ``1.1.1`` and only blind-signing is possible. Clear-signing will be available in the near future.
Currently used version of `Starknet app <https://github.com/LedgerHQ/app-starknet>`_ is ``2.3.1``.

.. codesnippet:: ../../starknet_py/tests/unit/signer/test_ledger_signer.py
:language: python
Expand Down
9 changes: 7 additions & 2 deletions docs/migration_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ Migration guide
===============

**********************
0.26.3 Migration guide
0.27.0 Migration guide
**********************

0.26.3 Bugfixes
.. py:currentmodule:: starknet_py.net.signer.ledger_signer

1. Support for clear signing with :class:`LedgerSigner` has been added. It's now the default signing mode (see :class:`LedgerSigningMode`).
2. ``derivation_path_str`` param has been removed from :class:`LedgerSigner` constructor, while ``account_id``, ``application_name`` and ``signing_mode`` params have been added.

0.27.0 Bugfixes
---------------

1. ABI parser supports now fixed size arrays.
Expand Down
494 changes: 65 additions & 429 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ docs = [
]
ledger = [
"ledgerwallet>=0.5.0,<1.0.0",
"bip-utils>=2.9.3,<3.0.0",
]

[project.urls]
Expand Down
12 changes: 4 additions & 8 deletions starknet_py/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@

ROOT_PATH = Path(__file__).parent

# Ledger constants
STARKNET_CLA = 0x5A
EIP_2645_PURPOSE = 0x80000A55
EIP_2645_PATH_LENGTH = 6
PUBLIC_KEY_RESPONSE_LENGTH = 65
SIGNATURE_RESPONSE_LENGTH = 65
VERSION_RESPONSE_LENGTH = 3

Comment on lines -42 to -49
Copy link
Collaborator Author

@franciszekjob franciszekjob May 12, 2025

Choose a reason for hiding this comment

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

note: These variables aren't used across multiple files so let's keep them in the dedicated (ledger) one.

# Result of `encode_shortstring("ANY_CALLER")`
ANY_CALLER = 0x414E595F43414C4C4552

Expand All @@ -58,3 +50,7 @@ class OutsideExecutionInterfaceID(IntEnum):


EXPECTED_RPC_VERSION = "0.8.1"

ARGENT_V040_CLASS_HASH = (
0x036078334509B514626504EDC9FB252328D1A240E4E948BEF8D0C08DFF45927F
)
Loading
Loading