Skip to content

Commit

Permalink
Fix sign_message for eip191
Browse files Browse the repository at this point in the history
  • Loading branch information
moisses89 committed Jun 18, 2024
1 parent 3911dfd commit 949e84f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/safe_cli/operators/safe_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def sign_message(
else:
print_formatted_text("EIP191 message to sign:")
message = get_input()
message_bytes = eip191_message.encode("UTF-8")
message_bytes = message.encode("UTF-8")

safe_message_hash = self.safe.get_message_hash(message_bytes)

Expand Down
4 changes: 3 additions & 1 deletion tests/test_safe_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ def test_sign_message(self, mock_sign_message_lib_address):
safe_operator.accounts.add(self.ethereum_test_account)
safe_operator.default_sender = self.ethereum_test_account
message_hash = safe_operator.safe.get_message_hash(bytes(message, "utf-8"))
safe_operator.sign_message(eip191_message=message)
with mock.patch("builtins.input", return_value=message):
safe_operator.sign_message(eip191_message=True)

self.assertTrue(safe_operator.safe.retrieve_is_message_signed(message_hash))
eip712_path = "tests/mocks/mock_eip712.json"
message = json.load(open(eip712_path, "r"))
Expand Down

0 comments on commit 949e84f

Please sign in to comment.