-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
test: enable TxQ unit tests work with variable reference fee #5118
base: develop
Are you sure you want to change the base?
test: enable TxQ unit tests work with variable reference fee #5118
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #5118 +/- ##
=======================================
Coverage 78.1% 78.1%
=======================================
Files 790 790
Lines 67908 67908
Branches 8229 8226 -3
=======================================
+ Hits 53024 53033 +9
+ Misses 14884 14875 -9 |
2a44022
to
83ce629
Compare
auto const& txq = env.app().getTxQ(); | ||
auto const& txs = txq.getAccountTxs(account.id()); | ||
|
||
return txs.begin()->feeLevel.fee(); |
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.
This assumes all transactions made by an account use the same fee. While entirely reasonable, would it be worth it to have tests where the fee amount differs within the same test between transactions made by an account?
In #5145 the tests are run in parallel using different amounts, but also there the fee amounts are the same within a single test.
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.
I'm not sure I understand the question. This is helper function to specifically get the first transaction the account inserted into the ledger. I don't see it being used elsewhere for any reason except few cases here in this test suit
// Calculating expected median fee level based on known fee levels of median | ||
// transaction levels. | ||
auto | ||
calcMedFeeLevel(FeeLevel64 const feeLevel1, FeeLevel64 const feeLevel2) |
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.
Isn't there an existing function you can call? Since the fee level is determined by the transactions seen and used in the non-test code, surely there must be a function that already does this?
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.
There's the code that does that:
rippled/src/xrpld/app/misc/detail/TxQ.cpp
Line 172 in 5bf3a30
TxQ::FeeMetrics::scaleFeeLevel(Snapshot const& snapshot, OpenView const& view) |
Unfortunately this is inside of a struct that is declared private inside of transaction queue. Without changes to the actual code it's not possible to use
High Level Overview of Change
Fix TxQ unit tests to be able to process reference fee value other than 10.
Context of Change
In preparation for potential reference fee change we would like to verify that fee change works as expected. The first step is to fix all unit tests to be able to work with different reference fee values.
Type of Change
API Impact
None
Test Plan
Tested following reference fee values:
10, 20, 50, 100, 200, 500, 1000
by changing https://github.com/vvysokikh1/rippled/blob/2f432e812cb773048530ebfaf2e0e6def51e3cc2/src/test/jtx/impl/envconfig.cpp#L47