eth-prototype 1.3.2__tar.gz → 1.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/PKG-INFO +1 -1
  2. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/eth_prototype.egg-info/PKG-INFO +1 -1
  3. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/aa_bundler.py +15 -6
  4. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/.coveragerc +0 -0
  5. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/.github/workflows/publish.yaml +0 -0
  6. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/.github/workflows/test.yaml +0 -0
  7. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/.gitignore +0 -0
  8. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/.isort.cfg +0 -0
  9. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/.pre-commit-config.yaml +0 -0
  10. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/.readthedocs.yml +0 -0
  11. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/AUTHORS.rst +0 -0
  12. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/CHANGELOG.rst +0 -0
  13. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/LICENSE.txt +0 -0
  14. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/README.md +0 -0
  15. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/docs/Makefile +0 -0
  16. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/docs/_static/.gitignore +0 -0
  17. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/docs/authors.rst +0 -0
  18. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/docs/changelog.rst +0 -0
  19. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/docs/conf.py +0 -0
  20. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/docs/index.rst +0 -0
  21. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/docs/license.rst +0 -0
  22. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/docs/readme.rst +0 -0
  23. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/docs/requirements.txt +0 -0
  24. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/pyproject.toml +0 -0
  25. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/setup.cfg +0 -0
  26. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/setup.py +0 -0
  27. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/eth_prototype.egg-info/SOURCES.txt +0 -0
  28. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/eth_prototype.egg-info/dependency_links.txt +0 -0
  29. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/eth_prototype.egg-info/not-zip-safe +0 -0
  30. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/eth_prototype.egg-info/requires.txt +0 -0
  31. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/eth_prototype.egg-info/top_level.txt +0 -0
  32. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/__init__.py +0 -0
  33. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/build_artifacts.py +0 -0
  34. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/contracts.py +0 -0
  35. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/defender_relay.py +0 -0
  36. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/test_utils/__init__.py +0 -0
  37. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/test_utils/factories.py +0 -0
  38. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/test_utils/hardhat.py +0 -0
  39. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/test_utils/vcr_utils.py +0 -0
  40. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/w3wrappers.py +0 -0
  41. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/wadray.py +0 -0
  42. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/src/ethproto/wrappers.py +0 -0
  43. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/__init__.py +0 -0
  44. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/cassettes/test_aa_bundler/test_build_user_operation.yaml +0 -0
  45. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/conftest.py +0 -0
  46. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/README.md +0 -0
  47. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/artifacts2/TestCurrency.sol/TestCurrency.json +0 -0
  48. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/Count.sol +0 -0
  49. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/Counter.sol +0 -0
  50. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/CounterUpgradeable.sol +0 -0
  51. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/CounterUpgradeableWithLibrary.sol +0 -0
  52. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/CounterWithLibrary.sol +0 -0
  53. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/Datatypes.sol +0 -0
  54. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/EventLauncher.sol +0 -0
  55. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/TestCurrency.sol +0 -0
  56. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/TestCurrencyUUPS.sol +0 -0
  57. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/contracts/TestNFT.sol +0 -0
  58. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/hardhat.config.js +0 -0
  59. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/package-lock.json +0 -0
  60. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/package.json +0 -0
  61. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/verifiable-binaries/@anotherOrg/aPkg/1.0.2/build/contracts/TestCurrency.sol/TestCurrency.json +0 -0
  62. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/verifiable-binaries/@org/pkg/0.2.1/build/contracts/TestCurrency.json +0 -0
  63. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/hardhat-project/verifiable-binaries/@org/pkg/0.3.0/build/contracts/TestCurrency.json +0 -0
  64. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/test_aa_bundler.py +0 -0
  65. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/test_build_artifacts.py +0 -0
  66. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/test_contracts.py +0 -0
  67. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/test_defender.py +0 -0
  68. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/test_time_control.py +0 -0
  69. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/test_w3.py +0 -0
  70. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tests/test_wadray.py +0 -0
  71. {eth_prototype-1.3.2 → eth_prototype-1.3.3}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eth-prototype
3
- Version: 1.3.2
3
+ Version: 1.3.3
4
4
  Summary: Prototype Ethereum Smart Contracts in Python
5
5
  Home-page: https://github.com/gnarvaja/eth-prototype
6
6
  Author: Guillermo M. Narvaja
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eth-prototype
3
- Version: 1.3.2
3
+ Version: 1.3.3
4
4
  Summary: Prototype Ethereum Smart Contracts in Python
5
5
  Home-page: https://github.com/gnarvaja/eth-prototype
6
6
  Author: Guillermo M. Narvaja
@@ -29,6 +29,7 @@ AA_BUNDLER_GAS_LIMIT_FACTOR = env.float("AA_BUNDLER_GAS_LIMIT_FACTOR", 1)
29
29
  AA_BUNDLER_PRIORITY_GAS_PRICE_FACTOR = env.float("AA_BUNDLER_PRIORITY_GAS_PRICE_FACTOR", 1)
30
30
  AA_BUNDLER_BASE_GAS_PRICE_FACTOR = env.float("AA_BUNDLER_BASE_GAS_PRICE_FACTOR", 1)
31
31
  AA_BUNDLER_VERIFICATION_GAS_FACTOR = env.float("AA_BUNDLER_VERIFICATION_GAS_FACTOR", 1)
32
+ AA_BUNDLER_MAX_FEE_PER_GAS = env.int("AA_BUNDLER_MAX_FEE_PER_GAS", 200000000000) # 200 gwei
32
33
 
33
34
  AA_BUNDLER_STATE_OVERRIDES = env.json("AA_BUNDLER_STATE_OVERRIDES", default={})
34
35
 
@@ -329,6 +330,7 @@ class Bundler:
329
330
  gas_limit_factor: float = AA_BUNDLER_GAS_LIMIT_FACTOR,
330
331
  priority_gas_price_factor: float = AA_BUNDLER_PRIORITY_GAS_PRICE_FACTOR,
331
332
  base_gas_price_factor: float = AA_BUNDLER_BASE_GAS_PRICE_FACTOR,
333
+ max_fee_per_gas: int = AA_BUNDLER_MAX_FEE_PER_GAS,
332
334
  executor_pk: HexBytes = AA_BUNDLER_EXECUTOR_PK,
333
335
  overrides: StateOverride = AA_BUNDLER_STATE_OVERRIDES,
334
336
  ):
@@ -343,6 +345,7 @@ class Bundler:
343
345
  self.priority_gas_price_factor = priority_gas_price_factor
344
346
  self.base_gas_price_factor = base_gas_price_factor
345
347
  self.executor_pk = executor_pk
348
+ self.max_fee_per_gas = max_fee_per_gas
346
349
 
347
350
  # stateOverrideSet mapping to use when calling eth_estimateUserOperationGas
348
351
  # https://docs.alchemy.com/reference/eth-estimateuseroperationgas
@@ -353,7 +356,7 @@ class Bundler:
353
356
  f"Bundler(type={self.bundler_type}, entrypoint={self.entrypoint}, nonce_mode={self.nonce_mode}, "
354
357
  f"fixed_nonce_key={self.fixed_nonce_key}, verification_gas_factor={self.verification_gas_factor}, "
355
358
  f"gas_limit_factor={self.gas_limit_factor}, priority_gas_price_factor={self.priority_gas_price_factor}, "
356
- f"base_gas_price_factor={self.base_gas_price_factor})"
359
+ f"base_gas_price_factor={self.base_gas_price_factor}, max_fee_per_gas={self.max_fee_per_gas})"
357
360
  )
358
361
 
359
362
  def get_nonce_and_key(self, tx: Tx, fetch=False):
@@ -406,10 +409,17 @@ class Bundler:
406
409
  if "error" in resp:
407
410
  raise BundlerRevertError(resp["error"]["message"], response=resp)
408
411
  max_priority_fee_per_gas = int(int(resp["result"], 16) * self.priority_gas_price_factor)
409
- max_fee_per_gas = max_priority_fee_per_gas + self.get_base_fee()
412
+ max_fee_per_gas = min(max_priority_fee_per_gas + self.get_base_fee(), self.max_fee_per_gas)
410
413
 
411
414
  return GasPrice(max_priority_fee_per_gas=max_priority_fee_per_gas, max_fee_per_gas=max_fee_per_gas)
412
415
 
416
+ def generic_gas_price(self):
417
+ base_fee = self.get_base_fee()
418
+ priority_fee = self.w3.eth.max_priority_fee
419
+ max_priority_fee_per_gas = int(priority_fee * self.priority_gas_price_factor)
420
+ max_fee_per_gas = min(max_priority_fee_per_gas + base_fee, self.max_fee_per_gas)
421
+ return GasPrice(max_priority_fee_per_gas=max_priority_fee_per_gas, max_fee_per_gas=max_fee_per_gas)
422
+
413
423
  def build_user_operation(self, tx: Tx, retry_nonce=None) -> UserOperation:
414
424
  nonce_key, nonce = self.get_nonce_and_key(tx, fetch=retry_nonce is not None)
415
425
  # Consume the nonce, even if the userop may fail later
@@ -422,16 +432,15 @@ class Bundler:
422
432
 
423
433
  if self.bundler_type == "alchemy":
424
434
  gas_price = self.alchemy_gas_price()
425
- user_operation = user_operation.add_gas_price(gas_price)
426
435
 
427
436
  elif self.bundler_type == "generic":
428
- # At the moment generic just prices the gas at 0
429
- pass
437
+ gas_price = self.generic_gas_price()
430
438
 
431
439
  else:
432
440
  warn(f"Unknown bundler_type: {self.bundler_type}")
441
+ gas_price = GasPrice(0, 0)
433
442
 
434
- return user_operation
443
+ return user_operation.add_gas_price(gas_price)
435
444
 
436
445
  def send_transaction(self, tx: Tx, retry_nonce=None):
437
446
  user_operation = self.build_user_operation(tx, retry_nonce).sign(
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes