-
Notifications
You must be signed in to change notification settings - Fork 107
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
refactor(plugins/execute): Refactor account refunds logic #1204
base: main
Are you sure you want to change the base?
Conversation
src/pytest_plugins/execute/sender.py
Outdated
@@ -104,7 +89,7 @@ def sender_key_initial_balance( | |||
assert seed_sender_balance_per_worker > 100, "Seed sender balance too low" | |||
# Subtract the cost of the transaction that is going to be sent to the seed sender | |||
sender_key_initial_balance = seed_sender_balance_per_worker - ( | |||
sender_fund_refund_gas_limit * sender_funding_transactions_gas_price | |||
sender_fund_refund_gas_limit * default_gas_price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sender_funding_transactions_gas_price I think that we should keep previous logic for supporting passing the price funding, the only change only need to pump refunding gas price from funding gas price ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returned the parameter, but it now defaults to the same value as --default-gas-price
, and we still bump the gas price for the refunds.
313abf6
to
574c060
Compare
🗒️ Description
Makes the following changes to help the refund logic complete in case of a failure during fixture setup:
Move Refund Logic to
pre
fixturePreviously the sender refund logic was placed in the
base_test_parametrizer
function, which is responsible for setting up thestate_test
,blockchain_test
, etc, fixtures that are used in tests to actually generate the test.The problem was that this fixture is not guaranteed to be the first fixture prepared during the pytest routine, so it could be that we had a fixture order preparation of:
pre
->sender
->blockchain_test
If an error occurred during the
sender
fixture setup, which potentially usedpre
fixture to fund a sender account, the refund logic would not be reached because the setup failed before reachingblockchain_test
The fix in this case is to put all the refund logic right in the
pre
fixture, and that way we can make sure that there is no potential fixture setup between thepre
and theblockchain_test
that could make the refund logic not take place.Deprecate
--sender-funding-txs-gas-price
in favor of a single--default-gas-price
Use the same value as
--default-gas-price
instead of having two separate parameters for each use.This is done in order to have a better estimation on replacement transactions.
Use A Replacement Transaction For Refunds
In the case of refunds, we now use a replacement transaction because it was difficult to estimate the real remaining balance of the sender account if there was a pending transaction in the mempool, so now we simply reuse the nonce to replace any transaction still present in the mempool.
Handle
eth_getTransactionByHash
Returningnull
Handles the case where the transaction could not be found by the client and a
null
(None
) response is returned.🔗 Related Issues
None
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.