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

GSW-1838 refactor: use avl.Tree in pool #430

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

r3v4s
Copy link
Member

@r3v4s r3v4s commented Dec 10, 2024

refactor

  1. use avl.Tree instead of map
  • currently map has issue with processing pointer value as key

image

@r3v4s r3v4s requested review from notJoon and onlyhyde December 10, 2024 08:28
@r3v4s r3v4s self-assigned this Dec 10, 2024
@r3v4s r3v4s added refactoring pool Pool contract related tasks labels Dec 10, 2024
notJoon
notJoon previously approved these changes Dec 10, 2024
Copy link
Member

@notJoon notJoon left a comment

Choose a reason for hiding this comment

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

👍

Base automatically changed from refactor/pool_grc20reg to main December 11, 2024 04:31
@notJoon notJoon dismissed their stale review December 11, 2024 04:31

The base branch was changed.

@dongwon8247 dongwon8247 changed the title GSW-1838 refactor: use avl.Tree GSW-1838 refactor: use avl.Tree in pool Dec 12, 2024
Copy link
Member

@onlyhyde onlyhyde left a comment

Choose a reason for hiding this comment

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

The base code of the current pr is too old; the application of avl.Tree should be applied from the modernized pool code. Needs to be updated

pool/tick.gno Outdated Show resolved Hide resolved
pool/tick.gno Outdated Show resolved Hide resolved
pool/tick.gno Outdated Show resolved Hide resolved
pool/tick_bitmap.gno Outdated Show resolved Hide resolved

bitmap, exist := pool.tickBitmaps.Get(wordPosStr)
if !exist {
pool.tickBitmaps.Set(wordPosStr, u256.Zero())
Copy link
Member

Choose a reason for hiding this comment

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

Extract initialize function

Copy link
Member Author

Choose a reason for hiding this comment

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

var bitPosAdjust uint
if lte {
bitPosAdjust = 1
}
Copy link
Member

Choose a reason for hiding this comment

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

@r3v4s
If lte is false, explicitly set 0 to bitPosAdjust
The semantics of bitOffset seems more appropriate than bitPosAdjust.

Copy link
Member Author

Choose a reason for hiding this comment

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

@r3v4s r3v4s force-pushed the refactor/pool_avl-instead-of-map branch from adec74f to bf8e09d Compare December 16, 2024 02:10
@r3v4s r3v4s marked this pull request as draft December 16, 2024 02:20
@r3v4s r3v4s marked this pull request as ready for review December 16, 2024 03:47
@r3v4s r3v4s requested review from onlyhyde and notJoon December 16, 2024 03:47
@r3v4s r3v4s force-pushed the refactor/pool_avl-instead-of-map branch from a926b6c to 71190c0 Compare December 16, 2024 06:35
Copy link

sonarcloud bot commented Dec 16, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pool Pool contract related tasks refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants