Skip to content

Commit df0727b

Browse files
authored
fix: eth signature sender verification (#145)
1 parent 9b5f862 commit df0727b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

ratio1/_ver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__VER__ = "3.4.110"
1+
__VER__ = "3.4.111"
22

33
if __name__ == "__main__":
44
with open("pyproject.toml", "rt") as fd:

ratio1/bc/evm.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,11 @@ def eth_verify_text_signature(
527527
528528
message_prefix : str, optional
529529
A prefix to be added to the message before hashing (or signing). The default is "".
530-
530+
531531
Returns
532532
-------
533-
bool or None
534-
True if the signature is valid, False otherwise.
533+
str
534+
The address of the signer or None if the signature is invalid
535535
"""
536536
types = ["string"]
537537
values = [message_prefix + text]
@@ -621,7 +621,10 @@ def eth_verify_payload_signature(
621621
indent : int, optional
622622
The indentation level for the JSON string. The default is 0.
623623
624-
624+
Returns
625+
-------
626+
str
627+
The address of the signer or None if the signature is invalid
625628
"""
626629
result = None
627630
_payload = deepcopy(payload)
@@ -645,7 +648,7 @@ def eth_verify_payload_signature(
645648
text=str_data, signature=signature, message_prefix=message_prefix,
646649
no_hash=no_hash, raise_if_error=raise_if_error
647650
)
648-
if result is None:
651+
if result is None or result.lower() != sender.lower():
649652
if raise_if_error:
650653
raise Exception("Signature verification failed.")
651654
else:

0 commit comments

Comments
 (0)