Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump safe-eth-py[django] from 5.8.0 to 6.0.0 #1300

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gunicorn==23.0.0
Pillow==11.0.0
psycopg2-binary==2.9.10
requests==2.32.3
safe-eth-py[django]==5.8.0
safe-eth-py[django]==6.0.0

# Without pin, safe-eth-py 5.8.0 installs >= 7 which breaks django-check job
# > ImportError: cannot import name 'geth_poa_middleware' from 'web3.middleware'
Expand Down
6 changes: 3 additions & 3 deletions src/chains/migrations/0008_chain_ens_registry_address.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2.5 on 2021-07-08 11:48

import gnosis.eth.django.models
import safe_eth.eth.django.models
from django.db import migrations


Expand All @@ -13,8 +13,8 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="chain",
name="ens_registry_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
]
4 changes: 2 additions & 2 deletions src/chains/migrations/0012_chain_gas_price_fixed_wei.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2.5 on 2021-07-14 09:18

import gnosis.eth.django.models
import safe_eth.eth.django.models
from django.db import migrations


Expand All @@ -16,7 +16,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="chain",
name="gas_price_fixed_wei",
field=gnosis.eth.django.models.Uint256Field( # type: ignore[no-untyped-call]
field=safe_eth.eth.django.models.Uint256Field( # type: ignore[no-untyped-call]
blank=True, null=True, verbose_name="Fixed gas price (wei)"
),
),
Expand Down
4 changes: 2 additions & 2 deletions src/chains/migrations/0023_create_gas_price_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 3.2.6 on 2021-09-01 12:38

import django.db.models.deletion
import gnosis.eth.django.models
import safe_eth.eth.django.models
from django.apps.registry import Apps
from django.db import migrations, models
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
Expand Down Expand Up @@ -58,7 +58,7 @@ class Migration(migrations.Migration):
),
(
"fixed_wei_value",
gnosis.eth.django.models.Uint256Field( # type: ignore[no-untyped-call]
safe_eth.eth.django.models.Uint256Field( # type: ignore[no-untyped-call]
blank=True, null=True, verbose_name="Fixed gas price (wei)"
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 4.2.3 on 2023-08-14 15:24

import gnosis.eth.django.models
import safe_eth.eth.django.models
from django.db import migrations


Expand All @@ -13,14 +13,14 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="gasprice",
name="max_fee_per_gas",
field=gnosis.eth.django.models.Uint256Field( # type: ignore[no-untyped-call]
field=safe_eth.eth.django.models.Uint256Field( # type: ignore[no-untyped-call]
blank=True, null=True, verbose_name="Max fee per gas (wei)"
),
),
migrations.AddField(
model_name="gasprice",
name="max_priority_fee_per_gas",
field=gnosis.eth.django.models.Uint256Field( # type: ignore[no-untyped-call]
field=safe_eth.eth.django.models.Uint256Field( # type: ignore[no-untyped-call]
blank=True, null=True, verbose_name="Max priority fee per gas (wei)"
),
),
Expand Down
38 changes: 19 additions & 19 deletions src/chains/migrations/0043_chain_create_call_address_and_more.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 5.0.6 on 2024-07-10 14:14

import gnosis.eth.django.models
import safe_eth.eth.django.models
from django.db import migrations


Expand All @@ -14,64 +14,64 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="chain",
name="create_call_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
migrations.AddField(
model_name="chain",
name="fallback_handler_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
migrations.AddField(
model_name="chain",
name="multi_send_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
migrations.AddField(
model_name="chain",
name="multi_send_call_only_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
migrations.AddField(
model_name="chain",
name="safe_proxy_factory_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
migrations.AddField(
model_name="chain",
name="safe_singleton_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
migrations.AddField(
model_name="chain",
name="sign_message_lib_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
migrations.AddField(
model_name="chain",
name="simulate_tx_accessor_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
migrations.AddField(
model_name="chain",
name="safe_web_authn_signer_factory_address",
field=gnosis.eth.django.models.EthereumAddressField(
field=safe_eth.eth.django.models.EthereumAddressField(
blank=True, null=True
), # type: ignore[no-untyped-call]
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Generated by Django 5.1.4 on 2024-12-10 09:34

import safe_eth.eth.django.models
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('chains', '0045_populate_feature_description'),
]

operations = [
migrations.AlterField(
model_name='chain',
name='create_call_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
migrations.AlterField(
model_name='chain',
name='ens_registry_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
migrations.AlterField(
model_name='chain',
name='fallback_handler_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
migrations.AlterField(
model_name='chain',
name='multi_send_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
migrations.AlterField(
model_name='chain',
name='multi_send_call_only_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
migrations.AlterField(
model_name='chain',
name='safe_proxy_factory_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
migrations.AlterField(
model_name='chain',
name='safe_singleton_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
migrations.AlterField(
model_name='chain',
name='safe_web_authn_signer_factory_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
migrations.AlterField(
model_name='chain',
name='sign_message_lib_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
migrations.AlterField(
model_name='chain',
name='simulate_tx_accessor_address',
field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, null=True),
),
]
24 changes: 12 additions & 12 deletions src/chains/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.core.validators import RegexValidator
from django.db import models
from django.db.models import QuerySet
from gnosis.eth.django.models import EthereumAddressField, Uint256Field
from safe_eth.eth.django.models import EthereumAddressBinaryField, Uint256Field

HEX_ARGB_REGEX = re.compile("^#[0-9a-fA-F]{6}$")

Expand Down Expand Up @@ -135,7 +135,7 @@ class RpcAuthentication(models.TextChoices):
default="#000000",
help_text="Please use the following format: <em>#RRGGBB</em>.",
)
ens_registry_address = EthereumAddressField(null=True, blank=True) # type: ignore[no-untyped-call]
ens_registry_address = EthereumAddressBinaryField(null=True, blank=True)
recommended_master_copy_version = models.CharField(
max_length=255, validators=[sem_ver_validator]
)
Expand All @@ -151,17 +151,17 @@ class RpcAuthentication(models.TextChoices):
help_text="This flag informs API clients whether the balances provider is enabled for the chain",
)
hidden = models.BooleanField(default=False)
safe_singleton_address = EthereumAddressField(null=True, blank=True) # type: ignore[no-untyped-call]
safe_proxy_factory_address = EthereumAddressField(null=True, blank=True) # type: ignore[no-untyped-call]
multi_send_address = EthereumAddressField(null=True, blank=True) # type: ignore[no-untyped-call]
multi_send_call_only_address = EthereumAddressField(null=True, blank=True) # type: ignore[no-untyped-call]
fallback_handler_address = EthereumAddressField(null=True, blank=True) # type: ignore[no-untyped-call]
sign_message_lib_address = EthereumAddressField(null=True, blank=True) # type: ignore[no-untyped-call]
create_call_address = EthereumAddressField(null=True, blank=True) # type: ignore[no-untyped-call]
simulate_tx_accessor_address = EthereumAddressField(null=True, blank=True) # type: ignore[no-untyped-call]
safe_web_authn_signer_factory_address = EthereumAddressField(
safe_singleton_address = EthereumAddressBinaryField(null=True, blank=True)
safe_proxy_factory_address = EthereumAddressBinaryField(null=True, blank=True)
multi_send_address = EthereumAddressBinaryField(null=True, blank=True)
multi_send_call_only_address = EthereumAddressBinaryField(null=True, blank=True)
fallback_handler_address = EthereumAddressBinaryField(null=True, blank=True)
sign_message_lib_address = EthereumAddressBinaryField(null=True, blank=True)
create_call_address = EthereumAddressBinaryField(null=True, blank=True)
simulate_tx_accessor_address = EthereumAddressBinaryField(null=True, blank=True)
safe_web_authn_signer_factory_address = EthereumAddressBinaryField(
null=True, blank=True
) # type: ignore[no-untyped-call]
)

def get_disabled_wallets(self) -> QuerySet["Wallet"]:
all_wallets = Wallet.objects.all()
Expand Down
2 changes: 1 addition & 1 deletion src/chains/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any

from drf_yasg.utils import swagger_serializer_method
from gnosis.eth.django.serializers import EthereumAddressField
from safe_eth.eth.django.serializers import EthereumAddressField
from rest_framework import serializers
from rest_framework.exceptions import APIException
from rest_framework.utils.serializer_helpers import ReturnDict
Expand Down
26 changes: 11 additions & 15 deletions src/chains/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_null_oracle_gas_oracle_with_null_fixed_gas_price(self) -> None:
def test_big_number() -> None:
gas_price = GasPriceFactory.create(
oracle_uri=None,
fixed_wei_value="115792089237316195423570985008687907853269984665640564039457584007913129639935",
fixed_wei_value=115792089237316195423570985008687907853269984665640564039457584007913129639935,
)

gas_price.full_clean()
Expand All @@ -96,17 +96,17 @@ def test_only_fixed1559_defined() -> None:
gas_price = GasPriceFactory.create(
oracle_uri=None,
fixed_wei_value=None,
max_fee_per_gas="100000",
max_priority_fee_per_gas="1000",
max_fee_per_gas=100000,
max_priority_fee_per_gas=1000,
)

gas_price.full_clean()

def test_fixed_and_fixed1559_defined(self) -> None:
gas_price = GasPriceFactory.create(
fixed_wei_value="100000",
max_fee_per_gas="100000",
max_priority_fee_per_gas="1000",
fixed_wei_value=100000,
max_fee_per_gas=100000,
max_priority_fee_per_gas=1000,
)

with self.assertRaises(ValidationError):
Expand All @@ -116,9 +116,9 @@ def test_fixed_and_fixed1559_and_oracle_defined(self) -> None:
gas_price = GasPriceFactory.create(
oracle_uri=self.faker.url(),
oracle_parameter="fake parameter",
fixed_wei_value="100000",
max_fee_per_gas="100000",
max_priority_fee_per_gas="1000",
fixed_wei_value=100000,
max_fee_per_gas=100000,
max_priority_fee_per_gas=1000,
)

with self.assertRaises(ValidationError):
Expand Down Expand Up @@ -217,12 +217,8 @@ def test_invalid_addresses(self) -> None:

for invalid_address in param_list:
with self.subTest(msg=f"Invalid address {invalid_address} should throw"):
with self.assertRaises(
(
# normalize_address from gnosis-py throws a generic Exception if the address is not valid
Exception,
)
):
with self.assertRaises(ValidationError):
print(invalid_address)
chain = ChainFactory.create(ens_registry_address=invalid_address)
# run validators
chain.full_clean()
Expand Down
2 changes: 1 addition & 1 deletion src/chains/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def test_fixed_gas_256_bit(self) -> None:
chain = ChainFactory.create(id=1)
GasPriceFactory.create(
chain=chain,
fixed_wei_value="115792089237316195423570985008687907853269984665640564039457584007913129639935",
fixed_wei_value=115792089237316195423570985008687907853269984665640564039457584007913129639935,
)
url = reverse("v1:chains:detail", args=[1])
expected_oracle_json_payload = [
Expand Down
Loading