Patch txpool core/list for managing multi currencies#43
Conversation
palango
left a comment
There was a problem hiding this comment.
Nice work, to me this feels like a better approach that the celo_list. Do you agree?
Some general notes:
- A short PR description is always helpful, with some hints on what might be surprising or some key design choices.
- Some tests are failing, I didn't check what causes them.
- There's still todos in the code, especially around error handling and the L1 cost. I didn't look into those.
- Are there other thing you intent on working in this PR?
One question around the design: There's lot's of new objects, and I'm not sure why you don't use functions instead. For example, the whitelistcheck struct is only created in NewWhitelistChecker, which is only used in LegacyPool.filter. Its IsWhitelisted method just passes down the request to FeeCurrencyValidator. For me this seems a bit meritless and I'd either use the validator directly or even the free IsWhitelisted function with the exchange rate stored in the txpool. What do you think?
Yes, but the celo_list approach had not be done to look cleaner, but to avoid the most common issues I used to have when merging upstream. However it might make sense to compromise a bit here.
I'm fixing them on the go, I didn't want to wait to start the review, I doubt they will need a big change to be fixed (I can always be surprised)
Everything regarding L1Cost was intentional, I'm not sure if we are clear on how we want to manage that in the pool.
No, unless there's something spotted in this review that I missed.
Many of this choices were made step by step and when you reach the final product you start cutting back, at least I already removed some as soon as I created the PR. |
CRU Move comment line Rename ToCurrencyValue to DenominateInCurrency list modification for celo changes list.Add and list.FilterBalance not working yet Cherry-pick of 704201f (@palango fee currency management) list.Add & some work on rates Add tests for list totalcost & whitelist filter Refactor FilterBalance for clarity & testiness Add test for list FilterBalance (gaslimit pruning) Add txcomparator Use ratesComparator for pricedList Add implementation of tx comparator Implement GetRatesFromState checking balance from txpool & lint fixes Ignore l1cost for the moment Add translate value impl Remove 'areequaladdresses' since golang pointer comparisons work Fix nil pointer Change functions signature type Change isCurrencyWhitelisted function to common Fix comment Add non-whitelisted test Fix some tests failing Changes list to use costCap in multicurrency fashion Remove translator Remove whitelist checker Remove unnecessary struct CRU Move getbalance to celobackend Add nonce replacement test to e2e tests Remove feeCurrencyValidator Move GetExchangeRates function to CeloBackend Add log Add current rates to legacypool Add more test cases for nonce replacement bump Code review updates remove txComparator as type, alias as function CRU
04eb06f to
e39a580
Compare
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
Modifies the legacypool, list, and priceheap to allow for multi currency txs. Update CompareWithRates to use new tx funcs #150 rename core/txpool/legacypool/celo_list_test.go Patch txpool core/list for managing multi currencies (#43) (#55) e2etest txpool: Check for fee currency and native cost The previous implementation only checked for the costs in fee currency or in native token, but both can happen at the same time when a fee currency tx is created that also sends native tokens to a contract. Closes #110
Modifies the legacypool, list, and priceheap to allow for multi currency txs. Update CompareWithRates to use new tx funcs #150 rename core/txpool/legacypool/celo_list_test.go Patch txpool core/list for managing multi currencies (#43) (#55) e2etest txpool: Check for fee currency and native cost The previous implementation only checked for the costs in fee currency or in native token, but both can happen at the same time when a fee currency tx is created that also sends native tokens to a contract. Closes #110
Modifies the legacypool, list, and priceheap to allow for multi currency txs. Update CompareWithRates to use new tx funcs #150 rename core/txpool/legacypool/celo_list_test.go Patch txpool core/list for managing multi currencies (#43) (#55) e2etest txpool: Check for fee currency and native cost The previous implementation only checked for the costs in fee currency or in native token, but both can happen at the same time when a fee currency tx is created that also sends native tokens to a contract. Closes #110
Patches the txpool for multi currency. Validation, List (per user nonce heap), TxComparator(pricedHeap)