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

Strategy usage #24

Merged
32 commits merged into from
Mar 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
73e3e0e
AsyncTxStrategy should do one of the following during execute: raise …
derekpierre Mar 1, 2024
013279c
Adjust strategies to accomodate latest paradigm for execute i.e. retu…
derekpierre Mar 1, 2024
9c2ec6e
Adjust existing strategy tests since None can now be returned from ex…
derekpierre Mar 1, 2024
39b4b36
Update timeout strategy logging.
derekpierre Mar 3, 2024
cf88810
Update speedup strategy calcs to use math.ceil instead of round
derekpierre Mar 3, 2024
1c01980
Move from a fixed max tip to a max tip factor based on the current su…
derekpierre Mar 4, 2024
352f74a
Simplify legacy transaction speedup logic.
derekpierre Mar 4, 2024
0be4f52
Add tests for constructor parameters and legacy tx speed up functiona…
derekpierre Mar 4, 2024
c023dea
Update logging of gas conditions.
derekpierre Mar 4, 2024
979f3f9
Better annotations about what the strategy is doing.
derekpierre Mar 4, 2024
9589151
Don't modify tx nonce as part of strategy.
derekpierre Mar 4, 2024
b66f5af
Fix outdated comment about value of warn factor.
derekpierre Mar 4, 2024
bf13194
Clean up logging logic since old_tip, old_max_fee may or may not be p…
derekpierre Mar 4, 2024
f7bd316
Add tests for eip1559 transaction speedup.
derekpierre Mar 4, 2024
699d38f
Rename speed up strategy; while the rate value is fixed the updates a…
derekpierre Mar 4, 2024
3755667
Use constant instead of "maxPriorityFeePerGas".
derekpierre Mar 4, 2024
16c2ed3
Use constant for minimum required speedup increase percentage.
derekpierre Mar 4, 2024
1c67055
Use a max between a low default value and warn factor calc in case ti…
derekpierre Mar 4, 2024
f8cf36b
Add todo about best way of setting a cap on the speedup strategy.
derekpierre Mar 4, 2024
1f1fb28
Use reactor to determine when hook is called instead of repeatedly ca…
derekpierre Mar 4, 2024
abb8555
Add TODO to determine whether strategies can be overriden.
derekpierre Mar 4, 2024
5491a6e
Update logging category for monitor when no longer tracking tx.
derekpierre Mar 5, 2024
2a9c0b5
Use enable/disabling of auto mining for better testing.
derekpierre Mar 5, 2024
436ce64
Fix nonce logging message for strategies.
derekpierre Mar 5, 2024
c7851ae
Add the ability to update the tracker's active pending tx after a retry.
derekpierre Mar 5, 2024
7e647c0
Ensure that "from" value in tx params matches/equals signer.
derekpierre Mar 5, 2024
283ba70
Make __fire reusable by both broadcast and strategize - it is now lim…
derekpierre Mar 5, 2024
bd27cbf
Add tests to ensure that strategies are employed when a tx hasn't alr…
derekpierre Mar 5, 2024
25ad0b5
Add testing for "from" tx parameter handling when a tx is being queued.
derekpierre Mar 6, 2024
adac77d
Add test for strategies which do not make updates to parameters.
derekpierre Mar 6, 2024
dc6cda3
Add testing statements to ensure that the broadcast hook is also call…
derekpierre Mar 6, 2024
28f67f4
txhash is not optionally returned from __fire - either it is or an ex…
derekpierre Mar 6, 2024
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
Prev Previous commit
Next Next commit
Use reactor to determine when hook is called instead of repeatedly ca…
…lling _cycle() on the machine - the latter could hide bugs so don't do it.
derekpierre committed Mar 4, 2024
commit 1f1fb288d86345de40890301b11a78be0a1a210d
16 changes: 10 additions & 6 deletions tests/test_faults.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import pytest_twisted
from twisted.internet import reactor
from twisted.internet.task import deferLater
from web3.exceptions import TransactionNotFound
from web3.types import TxReceipt

@@ -26,10 +29,14 @@ def _broadcast_tx(machine, eip1559_transaction, account, mocker):
return atx, fault_hook


@pytest_twisted.inlineCallbacks
def _verify_tx_faulted(machine, atx, fault_hook, expected_fault: Fault):
while fault_hook.call_count == 0:
# ensure tx processed
machine._cycle()
machine._cycle()

# ensure hook is called
yield deferLater(reactor, 0.2, lambda: None)
assert fault_hook.call_count == 1
fault_hook.assert_called_with(atx)

assert atx.final is False
assert isinstance(atx, FaultedTx)
@@ -42,9 +49,6 @@ def _verify_tx_faulted(machine, atx, fault_hook, expected_fault: Fault):
assert machine.pending is None
assert atx.final is False

assert fault_hook.call_count == 1
fault_hook.assert_called_with(atx)


def test_revert(
chain,