diff --git a/safe_transaction_service/history/serializers.py b/safe_transaction_service/history/serializers.py index c8306364b..0be6822ae 100644 --- a/safe_transaction_service/history/serializers.py +++ b/safe_transaction_service/history/serializers.py @@ -359,7 +359,7 @@ def check_delegate_signature( class DelegateSerializer(DelegateSignatureCheckerMixin, serializers.Serializer): - safe = EthereumAddressField(allow_null=True) + safe = EthereumAddressField(allow_null=True, required=False) delegate = EthereumAddressField() delegator = EthereumAddressField() signature = HexadecimalField(min_length=65) @@ -377,7 +377,7 @@ def get_safe_owners( def validate(self, data): super().validate(data) - safe_address: Optional[ChecksumAddress] = data["safe"] + safe_address: Optional[ChecksumAddress] = data.get("safe") if ( safe_address and not SafeContract.objects.filter(address=safe_address).exists() diff --git a/safe_transaction_service/history/tests/test_views.py b/safe_transaction_service/history/tests/test_views.py index b99b29320..3e931d2cb 100644 --- a/safe_transaction_service/history/tests/test_views.py +++ b/safe_transaction_service/history/tests/test_views.py @@ -1607,7 +1607,6 @@ def test_delegates_post(self): delegator = Account.create() label = "Saul Goodman" data = { - "safe": None, "delegate": delegate.address, "delegator": delegator.address, "label": label, diff --git a/safe_transaction_service/history/views.py b/safe_transaction_service/history/views.py index 337caebda..8e39686a9 100644 --- a/safe_transaction_service/history/views.py +++ b/safe_transaction_service/history/views.py @@ -593,7 +593,7 @@ def post(self, request, address, **kwargs): signer will update the label or delegator if different. For the signature we are using TOTP with `T0=0` and `Tx=3600`. TOTP is calculated by taking the Unix UTC epoch time (no milliseconds) and dividing by 3600 (natural division, no decimals) - For signature this hash need to be signed: keccak(address + str(int(current_epoch // 3600))) + For signature this hash need to be signed: keccak(checksummed address + str(int(current_epoch // 3600))) For example: - We want to add the delegate `0x132512f995866CcE1b0092384A6118EDaF4508Ff` and `epoch=1586779140`. - `TOTP = epoch // 3600 = 1586779140 // 3600 = 440771` @@ -715,7 +715,7 @@ def post(self, request, **kwargs): signer will update the label or delegator if different. For the signature we are using TOTP with `T0=0` and `Tx=3600`. TOTP is calculated by taking the Unix UTC epoch time (no milliseconds) and dividing by 3600 (natural division, no decimals) - For signature this hash need to be signed: keccak(address + str(int(current_epoch // 3600))) + For signature this hash need to be signed: keccak(checksummed address + str(int(current_epoch // 3600))) For example: - We want to add the delegate `0x132512f995866CcE1b0092384A6118EDaF4508Ff` and `epoch=1586779140`. - `TOTP = epoch // 3600 = 1586779140 // 3600 = 440771`