Skip to content

Patch txpool core/list for managing multi currencies#43

Merged
hbandura merged 2 commits intocelo3from
hbandura/p_list
Feb 16, 2024
Merged

Patch txpool core/list for managing multi currencies#43
hbandura merged 2 commits intocelo3from
hbandura/p_list

Conversation

@hbandura
Copy link
Copy Markdown

@hbandura hbandura commented Jan 19, 2024

Patches the txpool for multi currency. Validation, List (per user nonce heap), TxComparator(pricedHeap)

@hbandura hbandura marked this pull request as ready for review January 30, 2024 09:28
@hbandura hbandura requested review from carterqw2 and palango January 30, 2024 09:28
Copy link
Copy Markdown

@palango palango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@hbandura
Copy link
Copy Markdown
Author

hbandura commented Jan 30, 2024

Nice work, to me this feels like a better approach that the celo_list. Do you agree?

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.

Some general notes:

  • A short PR description is always helpful, with some hints on what might be surprising or some key design choices.
    You are right, sorry about that.
  • Some tests are failing, I didn't check what causes them.

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)

  • There's still todos in the code, especially around error handling and the L1 cost. I didn't look into those.

Everything regarding L1Cost was intentional, I'm not sure if we are clear on how we want to manage that in the pool.
The logging I want to see how we are logging elsewhere first.

  • Are there other thing you intent on working in this PR?

No, unless there's something spotted in this review that I missed.

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?

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.
The specific you mentioned, whitelistchecker, was because I didn't want the list to have the stateDb, so I fixed that in a different object and passed that.
Still, I have been thinking in remove the whole state hierarchy call and use an exchangerate fixed in the pool for mostly everything except balances. I will attempt to make some of those changes and see how it looks.

@hbandura hbandura requested review from carterqw2 and palango February 2, 2024 16:33
@hbandura hbandura requested a review from carterqw2 February 6, 2024 20:34
@hbandura hbandura requested a review from carterqw2 February 7, 2024 17:30
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
@hbandura hbandura dismissed carterqw2’s stale review February 16, 2024 16:10

Fixes already made

@hbandura hbandura merged commit 9cb1ed5 into celo3 Feb 16, 2024
@hbandura hbandura deleted the hbandura/p_list branch February 16, 2024 16:11
@palango palango mentioned this pull request Feb 19, 2024
hbandura added a commit that referenced this pull request Feb 20, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
hbandura added a commit that referenced this pull request Feb 22, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
palango pushed a commit that referenced this pull request Apr 30, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
palango pushed a commit that referenced this pull request Apr 30, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
palango pushed a commit that referenced this pull request Apr 30, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
palango pushed a commit that referenced this pull request May 8, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy pushed a commit that referenced this pull request Apr 9, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy pushed a commit that referenced this pull request Apr 9, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy pushed a commit that referenced this pull request Apr 9, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy pushed a commit that referenced this pull request Apr 11, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy pushed a commit that referenced this pull request Apr 11, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy pushed a commit that referenced this pull request Apr 11, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request Apr 11, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request Apr 11, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request Apr 21, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request Apr 21, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request Apr 21, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request Apr 21, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request Apr 23, 2025
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
piersy added a commit that referenced this pull request Apr 24, 2025
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
piersy added a commit that referenced this pull request Apr 24, 2025
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
piersy added a commit that referenced this pull request Apr 29, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
ezdac pushed a commit that referenced this pull request Apr 30, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request May 1, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request May 1, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request May 1, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request May 2, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request May 6, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request May 8, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy added a commit that referenced this pull request May 12, 2025
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
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.

3 participants