safe-global / safe-cli

Command line utility for Safe
MIT License
211 stars 70 forks source link

CLI crashing when executing remove_proposed_transaction command with an owner that did not propose that tx #360

Closed JagoFigueroa closed 7 months ago

JagoFigueroa commented 7 months ago

Describe the bug We have an issue where the CLI will crash when one of the safe owners that did not create the original transaction that we want to remove tries to do so:

To Reproduce Steps to reproduce the behavior: -WIth owner 1, create a tx on tx-service mode -WIth a different owner, try to remove the proposed tx

Expected behavior Not possible to remove the transaction but we should show an error

Current behavior The CLI crashes:

tx-service > 0x0A64A32c010aa70fe79Ac32acAeFF0B3a7EE76b3 > remove_proposed_transaction 0x702b2c129754f4a1277de73f0b4eddc7622a3845035ac014e7bba9bbdb88fe70
The proposer with address: 0xc6b82bA149CFA113f8f48d5E3b1F78e933e16DfD wasn loaded
Make sure before signing in your None that the domain_hash and message_hash are both correct
Domain_hash: 5630d3fd7d15a6300198e5422557da71f768a71f95e401cc53b20b81f80bacad
Message_hash: 8273543e4d30eeeba8b4b22fd3807229110a9efff30a2b503dbdd0e879d01a39
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/bin/safe-cli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "...", line 156, in main
    safe_cli.loop()
  File "...", line 113, in loop
    self.prompt_parser.process_command(command)
  File "...", line 148, in process_command
    return args.func(args)
           ^^^^^^^^^^^^^^^
  File "...", line 42, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...", line 320, in remove_proposed_transaction
    safe_operator.remove_proposed_transaction(args.safe_tx_hash)
  File ".../safe_tx_service_operator.py", line 451, in remove_proposed_transaction
    signature = self.hw_wallet_manager.sign_eip712(eip712_message, [signer])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../safe_cli/operators/hw_wallets/hw_wallet_manager.py", line 136, in sign_eip712
    signature = wallet.sign_typed_hash(domain_hash, message_hash)
                ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'sign_typed_hash'