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

Patch txpool core/list for managing multi currencies #43

Merged
merged 2 commits into from
Feb 16, 2024

Conversation

hbandura
Copy link

@hbandura hbandura commented Jan 19, 2024

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

core/txpool/celo_rates.go Outdated Show resolved Hide resolved
@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

@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?

contracts/fee_currencies.go Outdated Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/legacypool/list.go Show resolved Hide resolved
core/txpool/legacypool/list.go Outdated Show resolved Hide resolved
@hbandura
Copy link
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.

core/txpool/celo_rates_test.go Outdated Show resolved Hide resolved
core/txpool/celo_rates_test.go Outdated Show resolved Hide resolved
core/txpool/celo_rates_test.go Outdated Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/celo_validation.go Outdated Show resolved Hide resolved
core/txpool/celo_validation.go Outdated Show resolved Hide resolved
core/txpool/legacypool/list.go Show resolved Hide resolved
@hbandura hbandura requested review from carterqw2 and palango February 2, 2024 16:33
core/celo_backend.go Outdated Show resolved Hide resolved
core/celo_evm.go Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/blobpool/blobpool.go Outdated Show resolved Hide resolved
core/txpool/celo_validation.go Outdated Show resolved Hide resolved
@hbandura hbandura requested a review from carterqw2 February 6, 2024 20:34
core/txpool/celo_validation.go Outdated Show resolved Hide resolved
core/txpool/validation.go Show resolved Hide resolved
core/txpool/validation.go Outdated Show resolved Hide resolved
core/celo_backend.go Outdated Show resolved Hide resolved
core/txpool/blobpool/celo_blobpool.go Outdated Show resolved Hide resolved
core/txpool/blobpool/blobpool.go Outdated Show resolved Hide resolved
core/txpool/legacypool/legacypool.go Show resolved Hide resolved
core/txpool/legacypool/list.go Outdated Show resolved Hide resolved
core/txpool/legacypool/celo_list.go Show resolved Hide resolved
core/txpool/legacypool/celo_list.go Show resolved Hide resolved
@hbandura hbandura requested a review from carterqw2 February 7, 2024 17:30
core/celo_backend.go Show resolved Hide resolved
core/celo_backend.go Outdated Show resolved Hide resolved
core/celo_backend.go Outdated Show resolved Hide resolved
core/celo_backend.go Outdated Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/celo_rates.go Outdated Show resolved Hide resolved
core/txpool/legacypool/legacypool.go Show resolved Hide resolved
core/txpool/legacypool/list.go Show resolved Hide resolved
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
6 checks passed
@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.
palango pushed a commit that referenced this pull request May 31, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
carterqw2 pushed a commit that referenced this pull request Jun 11, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb pushed a commit that referenced this pull request Jul 10, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb pushed a commit that referenced this pull request Jul 10, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb pushed a commit that referenced this pull request Jul 12, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb added a commit that referenced this pull request Jul 22, 2024
This change is meaningless, so let's revert to the upstream version to
keep the diff small.
karlb added a commit that referenced this pull request Jul 24, 2024
This change is meaningless, so let's revert to the upstream version to
keep the diff small.
karlb added a commit that referenced this pull request Jul 24, 2024
This change is meaningless, so let's revert to the upstream version to
keep the diff small.
karlb pushed a commit that referenced this pull request Aug 20, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb pushed a commit that referenced this pull request Aug 26, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb pushed a commit that referenced this pull request Aug 30, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb pushed a commit that referenced this pull request Oct 11, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb pushed a commit that referenced this pull request Dec 13, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb pushed a commit that referenced this pull request Dec 16, 2024
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
karlb pushed a commit that referenced this pull request Dec 17, 2024
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