From a52bb86e03ca713ac5f7411714d59d269752c817 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 06:57:38 +0000 Subject: [PATCH 01/10] Bump django-filter from 23.5 to 24.1 Bumps [django-filter](https://github.com/carltongibson/django-filter) from 23.5 to 24.1. - [Release notes](https://github.com/carltongibson/django-filter/releases) - [Changelog](https://github.com/carltongibson/django-filter/blob/main/CHANGES.rst) - [Commits](https://github.com/carltongibson/django-filter/compare/23.5...24.1) --- updated-dependencies: - dependency-name: django-filter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6a9c0e006..148c176d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ django-debug-toolbar django-debug-toolbar-force django-environ==0.11.2 django-extensions==3.2.3 -django-filter==23.5 +django-filter==24.1 django-imagekit==5.0.0 django-model-utils==4.4.0 django-redis==5.4.0 From f83d6a6eaa28887409f4663254131c3f9902ad04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 06:57:29 +0000 Subject: [PATCH 02/10] Bump redis from 5.0.2 to 5.0.3 Bumps [redis](https://github.com/redis/redis-py) from 5.0.2 to 5.0.3. - [Release notes](https://github.com/redis/redis-py/releases) - [Changelog](https://github.com/redis/redis-py/blob/master/CHANGES) - [Commits](https://github.com/redis/redis-py/compare/v5.0.2...v5.0.3) --- updated-dependencies: - dependency-name: redis dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 148c176d3..0469d7dcd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ pika==1.3.2 pillow==10.2.0 psycogreen==1.0.2 psycopg2==2.9.9 -redis==5.0.2 +redis==5.0.3 requests==2.31.0 safe-eth-py[django]==6.0.0b18 web3==6.15.1 From 780f5a49ff4127cca729f899d133b1f5cc14baad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 06:57:17 +0000 Subject: [PATCH 03/10] Bump faker from 24.0.0 to 24.1.0 Bumps [faker](https://github.com/joke2k/faker) from 24.0.0 to 24.1.0. - [Release notes](https://github.com/joke2k/faker/releases) - [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md) - [Commits](https://github.com/joke2k/faker/compare/v24.0.0...v24.1.0) --- updated-dependencies: - dependency-name: faker dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index f9d2d224e..4d9e2f92b 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,7 +3,7 @@ coverage==7.4.3 django-stubs==4.2.7 django-test-migrations==1.3.0 factory-boy==3.3.0 -faker==24.0.0 +faker==24.1.0 mypy==1.8.0 pytest==8.1.0 pytest-celery==0.0.0 From 6eff92c126491b4fa4cca94e420fb5e491ff7892 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 06:57:06 +0000 Subject: [PATCH 04/10] Bump pytest from 8.1.0 to 8.1.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.1.0 to 8.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.1.0...8.1.1) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index 4d9e2f92b..d443c2b87 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -5,7 +5,7 @@ django-test-migrations==1.3.0 factory-boy==3.3.0 faker==24.1.0 mypy==1.8.0 -pytest==8.1.0 +pytest==8.1.1 pytest-celery==0.0.0 pytest-django==4.8.0 pytest-env==1.1.3 From d53543edfa06759df3e78a4510fe5853ff8b9417 Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria Date: Thu, 14 Mar 2024 11:51:46 +0100 Subject: [PATCH 05/10] Use fast_keccak when posible - Depends on https://github.com/safe-global/safe-eth-py/pull/832 - Depends on https://github.com/safe-global/safe-eth-py/pull/832 --- requirements.txt | 2 +- .../history/tests/factories.py | 14 ++++----- .../history/tests/test_index_service.py | 4 +-- .../history/tests/test_migrations.py | 31 ++++++++++--------- .../history/tests/test_models.py | 8 ++--- .../history/tests/test_tx_processor.py | 8 ++--- .../history/tests/test_views.py | 11 +++---- .../notifications/tests/test_tasks.py | 9 +++--- 8 files changed, 44 insertions(+), 43 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0469d7dcd..c38b45399 100644 --- a/requirements.txt +++ b/requirements.txt @@ -32,5 +32,5 @@ psycogreen==1.0.2 psycopg2==2.9.9 redis==5.0.3 requests==2.31.0 -safe-eth-py[django]==6.0.0b18 +safe-eth-py[django]==6.0.0b21 web3==6.15.1 diff --git a/safe_transaction_service/history/tests/factories.py b/safe_transaction_service/history/tests/factories.py index a6dd4be69..bd37d7fa4 100644 --- a/safe_transaction_service/history/tests/factories.py +++ b/safe_transaction_service/history/tests/factories.py @@ -7,9 +7,9 @@ from factory.django import DjangoModelFactory from factory.fuzzy import FuzzyInteger from hexbytes import HexBytes -from web3 import Web3 from gnosis.eth.constants import NULL_ADDRESS +from gnosis.eth.utils import fast_keccak_text from gnosis.safe.safe_signature import SafeSignatureType from ..models import ( @@ -53,8 +53,8 @@ class Meta: gas_limit = factory.fuzzy.FuzzyInteger(100000000, 200000000) gas_used = factory.fuzzy.FuzzyInteger(100000, 500000) timestamp = factory.LazyFunction(timezone.now) - block_hash = factory.Sequence(lambda n: Web3.keccak(text=f"block-{n}").hex()) - parent_hash = factory.Sequence(lambda n: Web3.keccak(text=f"block{n - 1}").hex()) + block_hash = factory.Sequence(lambda n: fast_keccak_text(f"block-{n}").hex()) + parent_hash = factory.Sequence(lambda n: fast_keccak_text(f"block{n - 1}").hex()) class EthereumTxFactory(DjangoModelFactory): @@ -63,7 +63,7 @@ class Meta: block = factory.SubFactory(EthereumBlockFactory) tx_hash = factory.Sequence( - lambda n: Web3.keccak(text=f"ethereum_tx_hash-{n}").hex() + lambda n: fast_keccak_text(f"ethereum_tx_hash-{n}").hex() ) _from = factory.LazyFunction(lambda: Account.create().address) gas = factory.fuzzy.FuzzyInteger(1000, 5000) @@ -226,7 +226,7 @@ class Meta: module = factory.LazyFunction(lambda: Account.create().address) to = factory.LazyFunction(lambda: Account.create().address) value = FuzzyInteger(low=0, high=10) - data = factory.Sequence(lambda n: Web3.keccak(text=f"module-tx-{n}")) + data = factory.Sequence(lambda n: fast_keccak_text(f"module-tx-{n}")) operation = FuzzyInteger(low=0, high=1) failed = False @@ -236,7 +236,7 @@ class Meta: model = MultisigTransaction safe_tx_hash = factory.Sequence( - lambda n: Web3.keccak(text=f"multisig-tx-{n}").hex() + lambda n: fast_keccak_text(f"multisig-tx-{n}").hex() ) safe = factory.LazyFunction(lambda: Account.create().address) ethereum_tx = factory.SubFactory(EthereumTxFactory) @@ -263,7 +263,7 @@ class Meta: ethereum_tx = factory.SubFactory(EthereumTxFactory) multisig_transaction = factory.SubFactory(MultisigTransactionFactory) multisig_transaction_hash = factory.Sequence( - lambda n: Web3.keccak(text=f"multisig-confirmation-tx-{n}").hex() + lambda n: fast_keccak_text(f"multisig-confirmation-tx-{n}").hex() ) owner = factory.LazyFunction(lambda: Account.create().address) signature = None diff --git a/safe_transaction_service/history/tests/test_index_service.py b/safe_transaction_service/history/tests/test_index_service.py index b9c704070..90710f5b6 100644 --- a/safe_transaction_service/history/tests/test_index_service.py +++ b/safe_transaction_service/history/tests/test_index_service.py @@ -5,10 +5,10 @@ from eth_account import Account from requests.exceptions import ConnectionError as RequestsConnectionError -from web3 import Web3 from gnosis.eth import EthereumClient from gnosis.eth.tests.ethereum_test_case import EthereumTestCaseMixin +from gnosis.eth.utils import fast_keccak_text from ..models import ( EthereumTx, @@ -88,7 +88,7 @@ def test_create_or_update_from_tx_hashes_existing(self): # Test block hash changes ethereum_tx = ethereum_txs[0] - ethereum_tx.block.block_hash = Web3.keccak(text="aloha") + ethereum_tx.block.block_hash = fast_keccak_text("aloha") ethereum_tx.block.save(update_fields=["block_hash"]) tx_hash = ethereum_tx.tx_hash diff --git a/safe_transaction_service/history/tests/test_migrations.py b/safe_transaction_service/history/tests/test_migrations.py index bfa0060f7..0a9e2d17c 100644 --- a/safe_transaction_service/history/tests/test_migrations.py +++ b/safe_transaction_service/history/tests/test_migrations.py @@ -5,7 +5,8 @@ from django_test_migrations.migrator import Migrator from eth_account import Account -from web3 import Web3 + +from gnosis.eth.utils import fast_keccak, fast_keccak_text class TestMigrations(TestCase): @@ -25,13 +26,13 @@ def build_ethereum_tx(self, ethereum_block_class, ethereum_tx_class): gas_limit=2, gas_used=2, timestamp=timezone.now(), - block_hash=Web3.keccak(b"34"), - parent_hash=Web3.keccak(b"12"), + block_hash=fast_keccak(b"34"), + parent_hash=fast_keccak(b"12"), ) return ethereum_tx_class.objects.create( block=ethereum_block, - tx_hash=Web3.keccak(b"tx-hash"), + tx_hash=fast_keccak(b"tx-hash"), gas=23000, gas_price=1, nonce=0, @@ -53,7 +54,7 @@ def test_migration_forward_0068(self): ] for origin in origins: MultisigTransactionOld.objects.create( - safe_tx_hash=Web3.keccak(text=f"multisig-tx-{origin}").hex(), + safe_tx_hash=fast_keccak_text(f"multisig-tx-{origin}").hex(), safe=Account.create().address, value=0, operation=0, @@ -72,21 +73,21 @@ def test_migration_forward_0068(self): ) # String should keep string - hash = Web3.keccak(text=f"multisig-tx-{origins[0]}").hex() + hash = fast_keccak_text(f"multisig-tx-{origins[0]}").hex() self.assertEqual(MultisigTransactionNew.objects.get(pk=hash).origin, origins[0]) # String json should be converted to json - hash = Web3.keccak(text=f"multisig-tx-{origins[1]}").hex() + hash = fast_keccak_text(f"multisig-tx-{origins[1]}").hex() self.assertEqual( MultisigTransactionNew.objects.get(pk=hash).origin, json.loads(origins[1]) ) # Empty string should be empty object - hash = Web3.keccak(text=f"multisig-tx-{origins[2]}").hex() + hash = fast_keccak_text(f"multisig-tx-{origins[2]}").hex() self.assertEqual(MultisigTransactionNew.objects.get(pk=hash).origin, {}) # None should be empty object - hash = Web3.keccak(text=f"multisig-tx-{origins[2]}").hex() + hash = fast_keccak_text(f"multisig-tx-{origins[2]}").hex() self.assertEqual(MultisigTransactionNew.objects.get(pk=hash).origin, {}) def test_migration_backward_0068(self): @@ -99,7 +100,7 @@ def test_migration_backward_0068(self): origins = ["{ TestString", {"url": "https://example.com", "name": "app"}, {}] for origin in origins: MultisigTransactionNew.objects.create( - safe_tx_hash=Web3.keccak(text=f"multisig-tx-{origin}").hex(), + safe_tx_hash=fast_keccak_text(f"multisig-tx-{origin}").hex(), safe=Account.create().address, value=0, operation=0, @@ -118,17 +119,17 @@ def test_migration_backward_0068(self): ) # String should keep string - hash = Web3.keccak(text=f"multisig-tx-{origins[0]}").hex() + hash = fast_keccak_text(f"multisig-tx-{origins[0]}").hex() self.assertEqual(MultisigTransactionOld.objects.get(pk=hash).origin, origins[0]) # Json should be converted to a string json - hash = Web3.keccak(text=f"multisig-tx-{origins[1]}").hex() + hash = fast_keccak_text(f"multisig-tx-{origins[1]}").hex() self.assertEqual( MultisigTransactionOld.objects.get(pk=hash).origin, json.dumps(origins[1]) ) # Empty object should be None - hash = Web3.keccak(text=f"multisig-tx-{origins[2]}").hex() + hash = fast_keccak_text(f"multisig-tx-{origins[2]}").hex() self.assertEqual(MultisigTransactionOld.objects.get(pk=hash).origin, None) def test_migration_forward_0069(self): @@ -262,7 +263,7 @@ def test_migration_forward_0073_safe_apps_links(self): MultisigTransaction = new_state.apps.get_model("history", "MultisigTransaction") for origin in origins: MultisigTransaction.objects.create( - safe_tx_hash=Web3.keccak(text=f"multisig-tx-{origin}").hex(), + safe_tx_hash=fast_keccak_text(f"multisig-tx-{origin}").hex(), safe=Account.create().address, value=0, operation=0, @@ -310,7 +311,7 @@ def test_migration_backward_0073_safe_apps_links(self): MultisigTransaction = new_state.apps.get_model("history", "MultisigTransaction") for origin in origins: MultisigTransaction.objects.create( - safe_tx_hash=Web3.keccak(text=f"multisig-tx-{origin}").hex(), + safe_tx_hash=fast_keccak_text(f"multisig-tx-{origin}").hex(), safe=Account.create().address, value=0, operation=0, diff --git a/safe_transaction_service/history/tests/test_models.py b/safe_transaction_service/history/tests/test_models.py index a309cb5ce..1b1bb7230 100644 --- a/safe_transaction_service/history/tests/test_models.py +++ b/safe_transaction_service/history/tests/test_models.py @@ -9,8 +9,8 @@ from django.utils import timezone from eth_account import Account -from web3 import Web3 +from gnosis.eth.utils import fast_keccak_text from gnosis.safe.safe_signature import SafeSignatureType from safe_transaction_service.contracts.models import ContractQuerySet @@ -60,7 +60,7 @@ class TestModelSignals(TestCase): def test_bind_confirmations(self): - safe_tx_hash = Web3.keccak(text="prueba") + safe_tx_hash = fast_keccak_text("prueba") ethereum_tx = EthereumTxFactory() MultisigConfirmation.objects.create( ethereum_tx=ethereum_tx, @@ -87,7 +87,7 @@ def test_bind_confirmations(self): self.assertEqual(multisig_tx.confirmations.count(), 1) def test_bind_confirmations_reverse(self): - safe_tx_hash = Web3.keccak(text="prueba") + safe_tx_hash = fast_keccak_text("prueba") ethereum_tx = EthereumTxFactory() multisig_tx, _ = MultisigTransaction.objects.get_or_create( safe_tx_hash=safe_tx_hash, @@ -1257,7 +1257,7 @@ def test_get_or_create_from_block(self): # Test block with different block-hash but same block number mock_block_2 = dict(mock_block) - mock_block_2["hash"] = Web3.keccak(text="another-hash") + mock_block_2["hash"] = fast_keccak_text("another-hash") self.assertNotEqual(mock_block["hash"], mock_block_2["hash"]) with self.assertRaises(IntegrityError): EthereumBlock.objects.get_or_create_from_block(mock_block_2) diff --git a/safe_transaction_service/history/tests/test_tx_processor.py b/safe_transaction_service/history/tests/test_tx_processor.py index 3212f0bec..cced0136b 100644 --- a/safe_transaction_service/history/tests/test_tx_processor.py +++ b/safe_transaction_service/history/tests/test_tx_processor.py @@ -5,9 +5,9 @@ from eth_account import Account from eth_utils import keccak -from web3 import Web3 from gnosis.eth.ethereum_client import TracingManager +from gnosis.eth.utils import fast_keccak_text from gnosis.safe.safe_signature import SafeSignatureType from gnosis.safe.tests.safe_test_case import SafeTestCaseMixin @@ -340,7 +340,7 @@ def test_tx_processor_is_failed(self): ethereum_tx = EthereumTxFactory(logs=logs) self.assertTrue(tx_processor.is_failed(ethereum_tx, logs[0]["data"])) self.assertFalse( - tx_processor.is_failed(ethereum_tx, Web3.keccak(text="hola").hex()) + tx_processor.is_failed(ethereum_tx, fast_keccak_text("hola").hex()) ) # Event for Safes >= 1.1.1 @@ -359,7 +359,7 @@ def test_tx_processor_is_failed(self): ethereum_tx = EthereumTxFactory(logs=logs) self.assertTrue(tx_processor.is_failed(ethereum_tx, safe_tx_hash)) self.assertFalse( - tx_processor.is_failed(ethereum_tx, Web3.keccak(text="hola").hex()) + tx_processor.is_failed(ethereum_tx, fast_keccak_text("hola").hex()) ) # Event for Safes >= 1.4.1 @@ -378,7 +378,7 @@ def test_tx_processor_is_failed(self): ethereum_tx = EthereumTxFactory(logs=logs) self.assertTrue(tx_processor.is_failed(ethereum_tx, safe_tx_hash)) self.assertFalse( - tx_processor.is_failed(ethereum_tx, Web3.keccak(text="hola").hex()) + tx_processor.is_failed(ethereum_tx, fast_keccak_text("hola").hex()) ) def test_tx_is_version_breaking_signatures(self): diff --git a/safe_transaction_service/history/tests/test_views.py b/safe_transaction_service/history/tests/test_views.py index 499e0dff1..ee93ccc9e 100644 --- a/safe_transaction_service/history/tests/test_views.py +++ b/safe_transaction_service/history/tests/test_views.py @@ -19,11 +19,10 @@ from rest_framework import status from rest_framework.exceptions import ErrorDetail from rest_framework.test import APIRequestFactory, APITestCase, force_authenticate -from web3 import Web3 from gnosis.eth.constants import NULL_ADDRESS from gnosis.eth.ethereum_client import EthereumClient, TracingManager -from gnosis.eth.utils import fast_is_checksum_address +from gnosis.eth.utils import fast_is_checksum_address, fast_keccak_text from gnosis.safe import CannotEstimateGas, Safe, SafeOperationEnum from gnosis.safe.safe_signature import SafeSignature, SafeSignatureType from gnosis.safe.signatures import signature_to_bytes @@ -684,7 +683,7 @@ def test_get_module_transaction(self): ) def test_get_multisig_confirmation(self): - random_safe_tx_hash = Web3.keccak(text="enxebre").hex() + random_safe_tx_hash = fast_keccak_text("enxebre").hex() response = self.client.get( reverse( "v1:history:multisig-transaction-confirmations", @@ -710,7 +709,7 @@ def test_get_multisig_confirmation(self): self.assertEqual(response.data["count"], 2) def test_post_multisig_confirmation(self): - random_safe_tx_hash = Web3.keccak(text="enxebre").hex() + random_safe_tx_hash = fast_keccak_text("enxebre").hex() data = { "signature": Account.create() .signHash(random_safe_tx_hash)["signature"] @@ -819,7 +818,7 @@ def test_post_multisig_confirmation(self): self.assertEqual(MultisigConfirmation.objects.count(), 2) def test_get_multisig_transaction(self): - safe_tx_hash = Web3.keccak(text="gnosis").hex() + safe_tx_hash = fast_keccak_text("gnosis").hex() response = self.client.get( reverse("v1:history:multisig-transaction", args=(safe_tx_hash,)), format="json", @@ -903,7 +902,7 @@ def test_get_multisig_transaction(self): def test_delete_multisig_transaction(self): owner_account = Account.create() - safe_tx_hash = Web3.keccak(text="random-tx").hex() + safe_tx_hash = fast_keccak_text("random-tx").hex() url = reverse("v1:history:multisig-transaction", args=(safe_tx_hash,)) data = {"signature": "0x" + "1" * (130 * 2)} # 2 signatures of 65 bytes response = self.client.delete(url, format="json", data=data) diff --git a/safe_transaction_service/notifications/tests/test_tasks.py b/safe_transaction_service/notifications/tests/test_tasks.py index 40747a0a0..6f2a44e69 100644 --- a/safe_transaction_service/notifications/tests/test_tasks.py +++ b/safe_transaction_service/notifications/tests/test_tasks.py @@ -3,7 +3,8 @@ from django.test import TestCase from eth_account import Account -from web3 import Web3 + +from gnosis.eth.utils import fast_keccak_text from safe_transaction_service.history.models import ( EthereumTxCallType, @@ -91,7 +92,7 @@ def test_send_notification_owner_task(self): safe_address = safe_contract.address threshold = 2 owners = [Account.create().address for _ in range(2)] - safe_tx_hash = Web3.keccak(text="hola").hex() + safe_tx_hash = fast_keccak_text("hola").hex() with self.assertLogs(logger=task_logger) as cm: self.assertEqual( send_notification_owner_task.delay(safe_address, safe_tx_hash).result, @@ -183,7 +184,7 @@ def test_send_notification_owner_task(self): self.assertIn("does not require more confirmations", cm.output[0]) def test_send_notification_owner_delegate_task(self): - safe_tx_hash = Web3.keccak(text="aloha").hex() + safe_tx_hash = fast_keccak_text("aloha").hex() safe_contract = SafeContractFactory() safe_address = safe_contract.address safe_status = SafeLastStatusFactory(address=safe_address, threshold=3) @@ -218,7 +219,7 @@ def test_send_notification_owner_delegate_task(self): def test_send_notification_owner_task_called(self): safe_address = Account.create().address - safe_tx_hash = Web3.keccak(text="hola").hex() + safe_tx_hash = fast_keccak_text("hola").hex() payload = { "address": safe_address, "type": WebHookType.PENDING_MULTISIG_TRANSACTION.name, From ecea151db7c623cd9b4e08466eca9f61be144a0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ux=C3=ADo?= Date: Thu, 14 Mar 2024 13:58:46 +0100 Subject: [PATCH 06/10] Set version 4.36.0 --- safe_transaction_service/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/safe_transaction_service/__init__.py b/safe_transaction_service/__init__.py index 47486ddf5..32e121437 100644 --- a/safe_transaction_service/__init__.py +++ b/safe_transaction_service/__init__.py @@ -1,4 +1,4 @@ -__version__ = "4.35.1" +__version__ = "4.36.0" __version_info__ = tuple( int(num) if num.isdigit() else num for num in __version__.replace("-", ".", 1).split(".") From b764d8ca96ec4b19d03c29e4b08e12b86bb8b8e3 Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria <6909403+Uxio0@users.noreply.github.com> Date: Fri, 15 Mar 2024 14:17:11 +0100 Subject: [PATCH 07/10] Add more iterations for keccak benchmark script --- scripts/benchmark_keccak.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/benchmark_keccak.py b/scripts/benchmark_keccak.py index 1e75b253f..9b8d82c3d 100644 --- a/scripts/benchmark_keccak.py +++ b/scripts/benchmark_keccak.py @@ -6,32 +6,33 @@ from web3 import Web3 -def eth_hash_benchmark(): +def eth_hash_benchmark() -> str: return eth_hash_keccak(os.urandom(32)).hex() -def web3_benchmark(): +def web3_benchmark() -> str: return Web3.keccak(os.urandom(32)).hex() -def cryptodome_benchmark(): - k = crypto_keccak.new(data=os.urandom(32), digest_bits=256) - return k.hexdigest() +def cryptodome_benchmark() -> str: + return crypto_keccak.new(data=os.urandom(32), digest_bits=256).hexdigest() -def pysha3_benchmark(): +def pysha3_benchmark() -> str: return sha3.keccak_256(os.urandom(32)).hexdigest() if __name__ == "__main__": import timeit + iterations = 1_000_000 + print( "eth_hash", timeit.timeit( "eth_hash_benchmark()", setup="from __main__ import eth_hash_benchmark", - number=500000, + number=iterations, globals=globals(), ), ) @@ -40,7 +41,7 @@ def pysha3_benchmark(): timeit.timeit( "web3_benchmark()", setup="from __main__ import web3_benchmark", - number=500000, + number=iterations, globals=globals(), ), ) @@ -49,16 +50,16 @@ def pysha3_benchmark(): timeit.timeit( "cryptodome_benchmark()", setup="from __main__ import cryptodome_benchmark", - number=500000, + number=iterations, globals=globals(), ), ) print( - "pysha3", + "safe-pysha3", timeit.timeit( "pysha3_benchmark()", setup="from __main__ import pysha3_benchmark", - number=500000, + number=iterations, globals=globals(), ), ) From a57ab716f3c4d5728b82142a953dd7592930d97a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 07:00:10 +0000 Subject: [PATCH 08/10] Bump faker from 24.1.0 to 24.2.0 Bumps [faker](https://github.com/joke2k/faker) from 24.1.0 to 24.2.0. - [Release notes](https://github.com/joke2k/faker/releases) - [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md) - [Commits](https://github.com/joke2k/faker/compare/v24.1.0...v24.2.0) --- updated-dependencies: - dependency-name: faker dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index d443c2b87..8342b2e39 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,7 +3,7 @@ coverage==7.4.3 django-stubs==4.2.7 django-test-migrations==1.3.0 factory-boy==3.3.0 -faker==24.1.0 +faker==24.2.0 mypy==1.8.0 pytest==8.1.1 pytest-celery==0.0.0 From e2534dfbcbde9e8e18b76d3f381826584e7a931d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 06:59:44 +0000 Subject: [PATCH 09/10] Bump firebase-admin from 6.4.0 to 6.5.0 Bumps [firebase-admin](https://github.com/firebase/firebase-admin-python) from 6.4.0 to 6.5.0. - [Release notes](https://github.com/firebase/firebase-admin-python/releases) - [Commits](https://github.com/firebase/firebase-admin-python/compare/v6.4.0...v6.5.0) --- updated-dependencies: - dependency-name: firebase-admin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c38b45399..874488694 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ djangorestframework==3.14.0 djangorestframework-camel-case==1.4.2 docutils==0.20.1 drf-yasg[validation]==1.21.7 -firebase-admin==6.4.0 +firebase-admin==6.5.0 flower==2.0.1 gunicorn[gevent]==21.2.0 hexbytes==0.3.1 From 030c30cce662cd89f2f26fb4f982aab6802b41da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 09:00:24 +0000 Subject: [PATCH 10/10] Bump mypy from 1.8.0 to 1.9.0 Bumps [mypy](https://github.com/python/mypy) from 1.8.0 to 1.9.0. - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](https://github.com/python/mypy/compare/v1.8.0...1.9.0) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index 8342b2e39..fd3fbc885 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -4,7 +4,7 @@ django-stubs==4.2.7 django-test-migrations==1.3.0 factory-boy==3.3.0 faker==24.2.0 -mypy==1.8.0 +mypy==1.9.0 pytest==8.1.1 pytest-celery==0.0.0 pytest-django==4.8.0