Skip to content

Commit

Permalink
Disable gas estimation in L2 networks
Browse files Browse the repository at this point in the history
- Gas estimation is only required for Safes < 1.3.0
- Safes < 1.3.0 are not supported in L2 chains
- Client gateway is calling this endpoint when getting the recommended nonce, even if it's not needed
- A lot of RPC calls are wasted
- Closes #614

Related:
- safe-global/safe-client-gateway#681 (comment)
  • Loading branch information
Uxio0 committed Oct 26, 2023
1 parent f4635de commit afa71ad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions safe_transaction_service/history/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,12 @@ def post(self, request, address, *args, **kwargs):
if not SafeContract.objects.filter(address=address).exists():
return Response(status=status.HTTP_404_NOT_FOUND)

# This endpoint is only needed for Safes < 1.3.0, so it should be disabled for L2 chains as they
# don't support Safes below that version
if settings.ETH_L2_NETWORK:
response_serializer = self.response_serializer(data={"safe_tx_gas": 0})
return Response(status=status.HTTP_200_OK, data=response_serializer.data)

serializer = self.get_serializer(data=request.data)
if serializer.is_valid():
try:
Expand Down

0 comments on commit afa71ad

Please sign in to comment.