Skip to content

Commit 8481947

Browse files
committed
[v1.5.0] Use renamed method select_safe_encoded_message_hash_by_safe_version
1 parent e1fb810 commit 8481947

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

safe_transaction_service/history/serializers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
TxDecoderException,
3535
get_db_tx_decoder,
3636
)
37-
from safe_transaction_service.safe_messages.utils import select_hash_by_safe_version
37+
from safe_transaction_service.safe_messages.utils import (
38+
select_safe_encoded_message_hash_by_safe_version,
39+
)
3840
from safe_transaction_service.tokens.serializers import TokenInfoResponseSerializer
3941
from safe_transaction_service.utils.serializers import (
4042
EpochDateTimeField,
@@ -120,7 +122,7 @@ def validate_signature(self, signature: bytes):
120122
)
121123

122124
safe_owners = get_safe_owners(safe_address)
123-
safe_hash_preimage = select_hash_by_safe_version(
125+
safe_hash_preimage = select_safe_encoded_message_hash_by_safe_version(
124126
safe.get_version(), safe_tx.safe_tx_hash, safe_tx.safe_tx_hash_preimage
125127
)
126128
parsed_signatures = SafeSignature.parse_signature(
@@ -271,7 +273,7 @@ def validate(self, attrs):
271273
# TODO Make signature mandatory
272274
signature = attrs.get("signature", b"")
273275
# For v1.5.0+, the isValidSignature(bytes32,bytes) expects the original message_hash (bytes32),
274-
safe_signature_hash = select_hash_by_safe_version(
276+
safe_signature_hash = select_safe_encoded_message_hash_by_safe_version(
275277
safe.get_version(), safe_tx.safe_tx_hash, safe_tx.safe_tx_hash_preimage
276278
)
277279
parsed_signatures = SafeSignature.parse_signature(

safe_transaction_service/history/tests/test_views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
from safe_transaction_service.contracts.models import ContractQuerySet
3232
from safe_transaction_service.contracts.tests.factories import ContractFactory
3333
from safe_transaction_service.contracts.tx_decoder import DbTxDecoder
34-
from safe_transaction_service.safe_messages.utils import select_hash_by_safe_version
34+
from safe_transaction_service.safe_messages.utils import (
35+
select_safe_encoded_message_hash_by_safe_version,
36+
)
3537
from safe_transaction_service.tokens.models import Token
3638
from safe_transaction_service.tokens.tests.factories import TokenFactory
3739
from safe_transaction_service.utils.utils import datetime_to_str
@@ -1772,7 +1774,7 @@ def test_post_multisig_transaction_with_1271_signature(self):
17721774
safe_tx_hash = safe_tx.safe_tx_hash
17731775
safe_tx_hash_preimage = safe_tx.safe_tx_hash_preimage
17741776

1775-
selected_hash = select_hash_by_safe_version(
1777+
selected_hash = select_safe_encoded_message_hash_by_safe_version(
17761778
safe.get_version(), safe_tx_hash, safe_tx_hash_preimage
17771779
)
17781780

safe_transaction_service/safe_messages/serializers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from .utils import (
2525
get_message_encoded,
2626
get_safe_message_hash_and_preimage_for_message,
27-
select_hash_by_safe_version,
27+
select_safe_encoded_message_hash_by_safe_version,
2828
)
2929

3030

@@ -137,7 +137,7 @@ def validate(self, attrs):
137137
# not the Safe-encoded hash
138138
ethereum_client = get_auto_ethereum_client()
139139
safe = Safe(safe_address, ethereum_client)
140-
safe_message_preimage = select_hash_by_safe_version(
140+
safe_message_preimage = select_safe_encoded_message_hash_by_safe_version(
141141
safe.get_version(), safe_message_hash, safe_message_preimage
142142
)
143143
safe_signatures = SafeSignature.parse_signature(
@@ -186,7 +186,7 @@ def validate(self, attrs):
186186
assert to_0x_hex_str(safe_message_hash) == safe_message.message_hash
187187

188188
safe = Safe(safe_address, get_auto_ethereum_client())
189-
safe_message_preimage = select_hash_by_safe_version(
189+
safe_message_preimage = select_safe_encoded_message_hash_by_safe_version(
190190
safe.get_version(), safe_message_hash, safe_message_preimage
191191
)
192192
safe_signatures = SafeSignature.parse_signature(

safe_transaction_service/safe_messages/tests/test_views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from ..utils import (
3232
encode_eip191_message,
3333
encode_eip712_message,
34-
select_hash_by_safe_version,
34+
select_safe_encoded_message_hash_by_safe_version,
3535
)
3636
from .mocks import get_eip712_payload_mock
3737

@@ -299,7 +299,7 @@ def _test_safe_messages_create_using_1271_signature_view(self, safe_deployment_f
299299
fast_keccak(message_encoded)
300300
)
301301

302-
data = select_hash_by_safe_version(
302+
data = select_safe_encoded_message_hash_by_safe_version(
303303
safe.get_version(), safe_message_hash, safe_message_preimage
304304
)
305305

0 commit comments

Comments
 (0)