-
Notifications
You must be signed in to change notification settings - Fork 36
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
Set correct options when signing with Ledger #461
Conversation
@@ -96,6 +96,8 @@ def __init__(self, account_index: int = 0, address_index: int = 0) -> None: | |||
def sign_transaction(self, transaction: ITransaction) -> str: | |||
ledger_version = do_get_ledger_version() | |||
should_use_hash_signing = compare_versions(ledger_version, SIGN_USING_HASH_VERSION) >= 0 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do something (in the next PR) about the mypy / reviewdog warnings shown in PRs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will take a look
tx.signature = bytes.fromhex(account.sign_transaction(tx)) | ||
tx = sign_tx_by_guardian(args, tx) | ||
tx = sign_tx_by_guardian(args, tx, guardian_account) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In another PR, maybe we can follow the same pattern as above (as for signature) i.e. tx.guardianSignature =
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
tx.relayer_signature = bytes.fromhex(relayer_account.sign_transaction(tx)) | ||
except NoWalletProvided: | ||
logger.warning("Relayer wallet not provided. Transaction will not be signed by relayer.") | ||
except IncorrectWalletError: | ||
raise IncorrectWalletError("Relayer wallet does not match the relayer's address set in the transaction.") | ||
|
||
try: | ||
guardian_account = get_guardian_account_from_args(args) | ||
if isinstance(guardian_account, LedgerAccount): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can also extract it to a function such as _apply_options_for_hash_signing_if_appropriate(account, tx)
, since this logic is applied in three places (a bit of duplication).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do in a future PR.
No description provided.