Skip to content

Commit

Permalink
Add return types
Browse files Browse the repository at this point in the history
  • Loading branch information
Uxio0 committed Oct 27, 2022
1 parent a3f9c9b commit 975e787
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gnosis/safe/safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from eth_abi.packed import encode_abi_packed
from eth_account import Account
from eth_account.signers.local import LocalAccount
from eth_typing import ChecksumAddress
from eth_typing import ChecksumAddress, Hash32
from hexbytes import HexBytes
from web3 import Web3
from web3.contract import Contract
Expand Down Expand Up @@ -820,7 +820,7 @@ def estimate_tx_gas(self, to: str, value: int, data: bytes, operation: int) -> i
+ WEB3_ESTIMATION_OFFSET
)

def estimate_tx_operational_gas(self, data_bytes_length: int):
def estimate_tx_operational_gas(self, data_bytes_length: int) -> int:
"""
DEPRECATED. `estimate_tx_base_gas` already includes this.
Estimates the gas for the verification of the signatures and other safe related tasks
Expand All @@ -837,7 +837,7 @@ def estimate_tx_operational_gas(self, data_bytes_length: int):
threshold = self.retrieve_threshold()
return 15000 + data_bytes_length // 32 * 100 + 5000 * threshold

def get_message_hash(self, message: Union[str, bytes]) -> bytes:
def get_message_hash(self, message: Union[str, Hash32]) -> Hash32:
"""
Return hash of a message that can be signed by owners.
Expand Down
4 changes: 2 additions & 2 deletions gnosis/safe/tests/test_signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_eip1271_signing(self):
safe_message_hash,
)

# Use deprecated isValidSignature method
# Use deprecated isValidSignature method (receives bytes)
signature = owner.signHash(safe_message_hash)
is_valid_bytes_fn = compatibility_contract.get_function_by_signature(
"isValidSignature(bytes,bytes)"
Expand All @@ -55,7 +55,7 @@ def test_eip1271_signing(self):
bytes.fromhex("20c13b0b"),
)

# Use new isValidSignature method
# Use new isValidSignature method (receives bytes32 == hash of the message)
# Message needs to be hashed first
message_hash = Web3.keccak(text=message)
safe_message_hash = safe.get_message_hash(message_hash)
Expand Down

0 comments on commit 975e787

Please sign in to comment.