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

chore!: lbp refactor #185

Merged
merged 30 commits into from
Oct 20, 2021
Merged

chore!: lbp refactor #185

merged 30 commits into from
Oct 20, 2021

Conversation

jak-pan
Copy link
Contributor

@jak-pan jak-pan commented Oct 5, 2021

  • Remove unnecessary storage (last weight update, last weights)
  • Remove unnecessary tuples
  • Remove asset sorting - asset_a is now the asset you are selling (If conducting a sale)
  • Changed weights to % of the asset_a in the pool
  • Change weight
  • Remove pause
  • Consolidate functions
  • Fix tests
  • Fix docs
  • Update math / extract types
  • Fix readme

  • Audit

pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 10, 2021

Codecov Report

Merging #185 (117b941) into master (ae46540) will decrease coverage by 0.17%.
The diff coverage is 99.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
- Coverage   85.22%   85.04%   -0.18%     
==========================================
  Files          21       21              
  Lines        2132     2013     -119     
==========================================
- Hits         1817     1712     -105     
+ Misses        315      301      -14     
Impacted Files Coverage Δ
pallets/lbp/src/lib.rs 87.84% <98.36%> (+1.84%) ⬆️
pallets/lbp/src/benchmarking.rs 100.00% <100.00%> (ø)
primitives/src/traits.rs 71.42% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae46540...117b941. Read the comment docs.

@jak-pan jak-pan marked this pull request as ready for review October 13, 2021 00:51
@jak-pan jak-pan requested a review from mrq1911 October 13, 2021 00:51
@jak-pan jak-pan requested a review from Roznovjak October 13, 2021 00:51
@jak-pan jak-pan changed the title feat: lbp refactor chore!: lbp refactor Oct 13, 2021
@Roznovjak
Copy link
Collaborator

Roznovjak commented Oct 13, 2021

The problem with the build is caused by LBP benchmarking tests. We are trying to perform a trade, but our LBP sale is not running. LBP uses RelaychainBlockNumberProvider, and it is used to fetch the current block number. The previous implementation used System::<T>::set_block_number() to change the current block number in the benchmarks, but it doesn't modify a block number fetched from the RelaychainBlockNumberProvider. I was able to "fix" the error and take advantage of the fact that the current block is set to 1 (and use a hacky way to set the start of LBP to block 1). But this "hack" doesn't work for benchmarking the remove_liquidity where we should call this method after the end of an LBP event. Any ideas what to do with this issue? :head_bandage:
To summarize the issue: we can't use System::<T>::set_block_number() in benchmarks to set the current block number

@Roznovjak
Copy link
Collaborator

Roznovjak commented Oct 13, 2021

The problem with the build is caused by LBP benchmarking tests. We are trying to perform a trade, but our LBP sale is not running. LBP uses RelaychainBlockNumberProvider, and it is used to fetch the current block number. The previous implementation used System::<T>::set_block_number() to change the current block number in the benchmarks, but it doesn't modify a block number fetched from the RelaychainBlockNumberProvider. I was able to "fix" the error and take advantage of the fact that the current block is set to 1 (and use a hacky way to set the start of LBP to block 1). But this "hack" doesn't work for benchmarking the remove_liquidity where we should call this method after the end of an LBP event. Any ideas what to do with this issue? :head_bandage: To summarize the issue: we can't use System::<T>::set_block_number() in benchmarks to set the current block number

I have looked at the implementation of the remove_liquidity method and calling it before the start of a sell and after the end of a sell should not have impact on the resulting weights.

@Roznovjak
Copy link
Collaborator

Roznovjak commented Oct 14, 2021

The following topics need to be resolved:

otherwise it LGTM

@Roznovjak
Copy link
Collaborator

I get this error in the UI. When the types are not enclosed in the types group, everything works ok. Is it supposed to work when the types are enclosed?

FATAL: Unable to initialize the API: createType(Lookup195):: DoNotConstruct: Cannot construct unknown type CurrencyIdOf

pallets/lbp/src/lib.rs Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Show resolved Hide resolved
pallets/lbp/src/lib.rs Outdated Show resolved Hide resolved
pallets/lbp/src/lib.rs Show resolved Hide resolved
@mrq1911 mrq1911 merged commit 366f5e2 into master Oct 20, 2021
@jak-pan jak-pan deleted the lbp-refactor branch February 22, 2024 10:53
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