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

Additional testing for tracker and tx modules - mostly around serialization/deserialization #30

Merged
merged 70 commits into from
Mar 11, 2024

Conversation

derekpierre
Copy link
Member

@derekpierre derekpierre commented Mar 8, 2024

Based over #27

Fixes #29
Fixes #15

  • Tested serialization/deserialization of tracker information
  • Fixes issues arising with serialization of tx objects
  • Considerations made for eq has hash comparisons - pay special attention there when reviewing

…TransactionFaulted for unrecoverable/don't bother retrying errors, return updated params for an updated retry, or None if the strategy has no recommendation for updated params and the params should remain unchanged in which case wait for the existing tx a little while longer.

There is no need to raise a Wait exception, since other strategies may feel differently.
…rn None if the machine should do nothing and wait based on this strategy.

Remove Wait exception and its uses.
Ensure that even if some txs don't include both maxPriorityFeePerGas and maxFeePerGas the strategy still works.
Handle legacy transaction speed up.
Parameterize speed up factor and max tip.
Questions remain about the default for max tip, but since parameterized, less of an issue - but something to revisit.
…ggested tip as a way to limit the speedup strategy getting out of control.

Update maxFeePerGas depending on whether previously set or not - web3 py uses a default that doubles the base fee as part of maxFeePerGas so we probably don't want to further double that again.
Clean up constructor params validation and update tests.
Use tx.id in addition to nonce for speed up logs.
…resent in transaction parameters (eip1559 allows one or both).
…re expontential because they build on previous updates.
…meout is too short and warn threshold becomes too low.

Loosen warn factor from 5% to 15%.
…lling _cycle() on the machine - the latter could hide bugs so don't do it.
Don't have FutureTx store "from" separately from the the value in the params; it is redundant and complicates usage.
…ited to send raw transaction and returning the tx hash.

Update machine and strategies use "from" value in the tx params.
Make some functions void since unnecessary to return anything.
…. This allows for not needing extra logic for clearing out the dictionary used in the original tracking logic.

Instead requeues and retries can be tracked on the tx object itself. Requeues for FutureTx can easily be incremented via the requeue() call on the tracker.It's a little trickier with PendingTx since we only deal with copies in the machine, but added a method to the tracker to make this easier.
Updated tests.
…gies will be used by default. This way users totally control strategies used and their parameterized values instead of implicit defaults which have repercussions eg. cost for speed up strategy.

Update tests accordingly.
…eout is provided in the constructor for the machine and is either the default timeout value from the TimeoutStrategy class or a user provided timeout. This is a guardrail to prevent misconfigured strategies from never timing out causing the machine to forever wait on a long running tx.

Removed tests regarding no strategies since no longer applicable.
Also use inlineCallbacks now that reactor is used.
… tx types (FinalizedTx/FaultedTx) don't care typified by their serializations.

Force subclasses of AsyncTx to implement their own __eq__ and __hash__ methods; added implementations to each subclass.
…sure consistency with equality check, use serialized versions for comparison.

TxReceipt on FinalizedTx we only care about specific values; extra values get lost during serialization/deserialization. So to ensure consistency with equality check, use serialized versions for comparison.
@codecov-commenter
Copy link

codecov-commenter commented Mar 8, 2024

Codecov Report

Attention: Patch coverage is 99.35424% with 7 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@6248d7d). Click here to learn what that means.

Files Patch % Lines
atxm/machine.py 96.10% 3 Missing ⚠️
atxm/tx.py 92.59% 2 Missing ⚠️
tests/test_machine.py 99.41% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #30   +/-   ##
=======================================
  Coverage        ?   97.92%           
=======================================
  Files           ?       15           
  Lines           ?     2022           
  Branches        ?        0           
=======================================
  Hits            ?     1980           
  Misses          ?       42           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…lly be needed since it isn't tracked by the tracker. In any case because we sub-class from AsyncTx we test it anyway since implemented.
@derekpierre
Copy link
Member Author

Coverage as of 3245c0f:

Screenshot 2024-03-08 at 12 14 01 PM

@derekpierre derekpierre changed the title [WIP] Additional testing for tracker and tx modules - mostly around serialization/deserialization Additional testing for tracker and tx modules - mostly around serialization/deserialization Mar 8, 2024
@derekpierre derekpierre self-assigned this Mar 8, 2024
@derekpierre derekpierre marked this pull request as ready for review March 8, 2024 17:14
@KPrasch KPrasch merged commit 667030f into nucypher:main Mar 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve test coverage of tx and tracker modules Increase test coverage to be > 90%
3 participants