diff --git a/safe_transaction_service/account_abstraction/serializers.py b/safe_transaction_service/account_abstraction/serializers.py index 499f3da73..569ae2128 100644 --- a/safe_transaction_service/account_abstraction/serializers.py +++ b/safe_transaction_service/account_abstraction/serializers.py @@ -411,14 +411,14 @@ class UserOperationResponseSerializer(serializers.Serializer): sender = eth_serializers.EthereumAddressField() user_operation_hash = eth_serializers.HexadecimalField(source="hash") - nonce = serializers.IntegerField(min_value=0) + nonce = serializers.CharField() init_code = eth_serializers.HexadecimalField(allow_null=True) call_data = eth_serializers.HexadecimalField(allow_null=True) - call_gas_limit = serializers.IntegerField(min_value=0) - verification_gas_limit = serializers.IntegerField(min_value=0) - pre_verification_gas = serializers.IntegerField(min_value=0) - max_fee_per_gas = serializers.IntegerField(min_value=0) - max_priority_fee_per_gas = serializers.IntegerField(min_value=0) + call_gas_limit = serializers.CharField() + verification_gas_limit = serializers.CharField() + pre_verification_gas = serializers.CharField() + max_fee_per_gas = serializers.CharField() + max_priority_fee_per_gas = serializers.CharField() paymaster = eth_serializers.EthereumAddressField(allow_null=True) paymaster_data = eth_serializers.HexadecimalField(allow_null=True) signature = eth_serializers.HexadecimalField() diff --git a/safe_transaction_service/account_abstraction/tests/test_views.py b/safe_transaction_service/account_abstraction/tests/test_views.py index 1c5b03af9..0052812f8 100644 --- a/safe_transaction_service/account_abstraction/tests/test_views.py +++ b/safe_transaction_service/account_abstraction/tests/test_views.py @@ -69,16 +69,22 @@ def test_safe_operation_view(self): "safeOperationHash": safe_operation.hash, "userOperation": { "sender": safe_operation.user_operation.sender, - "nonce": safe_operation.user_operation.nonce, + "nonce": str(safe_operation.user_operation.nonce), "userOperationHash": safe_operation.user_operation.hash, "ethereumTxHash": safe_operation.user_operation.ethereum_tx_id, "initCode": "0x", "callData": "0x", - "callGasLimit": safe_operation.user_operation.call_gas_limit, - "verificationGasLimit": safe_operation.user_operation.verification_gas_limit, - "preVerificationGas": safe_operation.user_operation.pre_verification_gas, - "maxFeePerGas": safe_operation.user_operation.max_fee_per_gas, - "maxPriorityFeePerGas": safe_operation.user_operation.max_priority_fee_per_gas, + "callGasLimit": str(safe_operation.user_operation.call_gas_limit), + "verificationGasLimit": str( + safe_operation.user_operation.verification_gas_limit + ), + "preVerificationGas": str( + safe_operation.user_operation.pre_verification_gas + ), + "maxFeePerGas": str(safe_operation.user_operation.max_fee_per_gas), + "maxPriorityFeePerGas": str( + safe_operation.user_operation.max_priority_fee_per_gas + ), "paymaster": NULL_ADDRESS, "paymasterData": "0x", "entryPoint": safe_operation.user_operation.entry_point, @@ -149,16 +155,22 @@ def test_safe_operations_view(self): "safeOperationHash": safe_operation.hash, "userOperation": { "sender": safe_operation.user_operation.sender, - "nonce": safe_operation.user_operation.nonce, + "nonce": str(safe_operation.user_operation.nonce), "userOperationHash": safe_operation.user_operation.hash, "ethereumTxHash": safe_operation.user_operation.ethereum_tx_id, "initCode": "0x", "callData": "0x", - "callGasLimit": safe_operation.user_operation.call_gas_limit, - "verificationGasLimit": safe_operation.user_operation.verification_gas_limit, - "preVerificationGas": safe_operation.user_operation.pre_verification_gas, - "maxFeePerGas": safe_operation.user_operation.max_fee_per_gas, - "maxPriorityFeePerGas": safe_operation.user_operation.max_priority_fee_per_gas, + "callGasLimit": str(safe_operation.user_operation.call_gas_limit), + "verificationGasLimit": str( + safe_operation.user_operation.verification_gas_limit + ), + "preVerificationGas": str( + safe_operation.user_operation.pre_verification_gas + ), + "maxFeePerGas": str(safe_operation.user_operation.max_fee_per_gas), + "maxPriorityFeePerGas": str( + safe_operation.user_operation.max_priority_fee_per_gas + ), "paymaster": NULL_ADDRESS, "paymasterData": "0x", "signature": "0x" + "0" * 24, @@ -890,16 +902,22 @@ def test_user_operation_view(self): self.assertEqual(response.status_code, status.HTTP_200_OK) expected = { "sender": safe_operation.user_operation.sender, - "nonce": safe_operation.user_operation.nonce, + "nonce": str(safe_operation.user_operation.nonce), "userOperationHash": safe_operation.user_operation.hash, "ethereumTxHash": safe_operation.user_operation.ethereum_tx_id, "initCode": "0x", "callData": "0x", - "callGasLimit": safe_operation.user_operation.call_gas_limit, - "verificationGasLimit": safe_operation.user_operation.verification_gas_limit, - "preVerificationGas": safe_operation.user_operation.pre_verification_gas, - "maxFeePerGas": safe_operation.user_operation.max_fee_per_gas, - "maxPriorityFeePerGas": safe_operation.user_operation.max_priority_fee_per_gas, + "callGasLimit": str(safe_operation.user_operation.call_gas_limit), + "verificationGasLimit": str( + safe_operation.user_operation.verification_gas_limit + ), + "preVerificationGas": str( + safe_operation.user_operation.pre_verification_gas + ), + "maxFeePerGas": str(safe_operation.user_operation.max_fee_per_gas), + "maxPriorityFeePerGas": str( + safe_operation.user_operation.max_priority_fee_per_gas + ), "paymaster": NULL_ADDRESS, "paymasterData": "0x", "signature": "0x" + "0" * 24, @@ -935,7 +953,8 @@ def test_user_operations_view(self): response.json(), {"count": 0, "next": None, "previous": None, "results": []} ) safe_operation = factories.SafeOperationFactory( - user_operation__sender=safe_address + user_operation__sender=safe_address, + user_operation__nonce=131872201376309576872419307987365003264, ) response = self.client.get( reverse("v1:account_abstraction:user-operations", args=(safe_address,)) @@ -943,16 +962,22 @@ def test_user_operations_view(self): self.assertEqual(response.status_code, status.HTTP_200_OK) expected = { "sender": safe_operation.user_operation.sender, - "nonce": safe_operation.user_operation.nonce, + "nonce": str(safe_operation.user_operation.nonce), "userOperationHash": safe_operation.user_operation.hash, "ethereumTxHash": safe_operation.user_operation.ethereum_tx_id, "initCode": "0x", "callData": "0x", - "callGasLimit": safe_operation.user_operation.call_gas_limit, - "verificationGasLimit": safe_operation.user_operation.verification_gas_limit, - "preVerificationGas": safe_operation.user_operation.pre_verification_gas, - "maxFeePerGas": safe_operation.user_operation.max_fee_per_gas, - "maxPriorityFeePerGas": safe_operation.user_operation.max_priority_fee_per_gas, + "callGasLimit": str(safe_operation.user_operation.call_gas_limit), + "verificationGasLimit": str( + safe_operation.user_operation.verification_gas_limit + ), + "preVerificationGas": str( + safe_operation.user_operation.pre_verification_gas + ), + "maxFeePerGas": str(safe_operation.user_operation.max_fee_per_gas), + "maxPriorityFeePerGas": str( + safe_operation.user_operation.max_priority_fee_per_gas + ), "paymaster": NULL_ADDRESS, "paymasterData": "0x", "signature": "0x" + "0" * 24, diff --git a/safe_transaction_service/history/serializers.py b/safe_transaction_service/history/serializers.py index ad8bd4243..f953ded20 100644 --- a/safe_transaction_service/history/serializers.py +++ b/safe_transaction_service/history/serializers.py @@ -809,7 +809,7 @@ def get_data_decoded(self, obj: SafeCreationInfo) -> Dict[str, Any]: class SafeInfoResponseSerializer(serializers.Serializer): address = EthereumAddressField() - nonce = serializers.IntegerField() + nonce = serializers.CharField() threshold = serializers.IntegerField() owners = serializers.ListField(child=EthereumAddressField()) master_copy = EthereumAddressField() diff --git a/safe_transaction_service/history/tests/test_views.py b/safe_transaction_service/history/tests/test_views.py index aa47418fb..ef0cc3080 100644 --- a/safe_transaction_service/history/tests/test_views.py +++ b/safe_transaction_service/history/tests/test_views.py @@ -3379,16 +3379,22 @@ def test_safe_creation_view(self): self.assertEqual(response.status_code, status.HTTP_200_OK) expected["user_operation"] = { "sender": safe_operation.user_operation.sender, - "nonce": safe_operation.user_operation.nonce, + "nonce": str(safe_operation.user_operation.nonce), "user_operation_hash": safe_operation.user_operation.hash, "ethereum_tx_hash": internal_tx.ethereum_tx_id, "init_code": "0x1234", "call_data": "0x", - "call_gas_limit": safe_operation.user_operation.call_gas_limit, - "verification_gas_limit": safe_operation.user_operation.verification_gas_limit, - "pre_verification_gas": safe_operation.user_operation.pre_verification_gas, - "max_fee_per_gas": safe_operation.user_operation.max_fee_per_gas, - "max_priority_fee_per_gas": safe_operation.user_operation.max_priority_fee_per_gas, + "call_gas_limit": str(safe_operation.user_operation.call_gas_limit), + "verification_gas_limit": str( + safe_operation.user_operation.verification_gas_limit + ), + "pre_verification_gas": str( + safe_operation.user_operation.pre_verification_gas + ), + "max_fee_per_gas": str(safe_operation.user_operation.max_fee_per_gas), + "max_priority_fee_per_gas": str( + safe_operation.user_operation.max_priority_fee_per_gas + ), "paymaster": safe_operation.user_operation.paymaster, "paymaster_data": "0x", "signature": "0x" + safe_operation.user_operation.signature.hex(), @@ -3518,7 +3524,7 @@ def test_safe_info_view(self): response.data, { "address": blockchain_safe.address, - "nonce": 0, + "nonce": "0", "threshold": blockchain_safe.retrieve_threshold(), "owners": blockchain_safe.retrieve_owners(), "master_copy": blockchain_safe.retrieve_master_copy_address(),