Skip to content

feat: token cache#1068

Merged
robert-zaremba merged 12 commits intomainfrom
robert/token-cache
Jun 28, 2022
Merged

feat: token cache#1068
robert-zaremba merged 12 commits intomainfrom
robert/token-cache

Conversation

@robert-zaremba
Copy link
Copy Markdown
Contributor

Description

closes: #1064


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@robert-zaremba robert-zaremba requested a review from a team as a code owner June 24, 2022 15:14
@robert-zaremba robert-zaremba changed the title Robert/token cache feat: token cache Jun 24, 2022
@robert-zaremba robert-zaremba requested a review from a team as a code owner June 24, 2022 15:21
@adamewozniak
Copy link
Copy Markdown
Collaborator

Not super sure we need this imo, would cacheing the leverage token registry reduce load by that much?

@robert-zaremba
Copy link
Copy Markdown
Contributor Author

This is used in every tx method

@robert-zaremba
Copy link
Copy Markdown
Contributor Author

Also this is a safe cache.

Copy link
Copy Markdown
Collaborator

@adamewozniak adamewozniak left a comment

Choose a reason for hiding this comment

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

utACK - as long as unit tests pass I'm good

@toteki
Copy link
Copy Markdown
Contributor

toteki commented Jun 28, 2022

Unit tests right now are getting a lot of this

--- FAIL: TestSimTestSuite (0.04s)
    --- FAIL: TestSimTestSuite/TestSimulateMsgBorrowAsset (0.01s)
        suite.go:77: test panicked: runtime error: invalid memory address or nil pointer dereference
            goroutine 13 [running]:
            runtime/debug.Stack()
            	/opt/hostedtoolcache/go/1.18.3/x64/src/runtime/debug/stack.go:24 +0x65
            github.com/stretchr/testify/suite.failOnPanic(0xc0000c36c0, {0x19b1e20, 0x322f530})
            	/home/runner/go/pkg/mod/github.com/stretchr/testify@v1.7.5/suite/suite.go:77 +0x3b
            github.com/stretchr/testify/suite.Run.func1.1()
            	/home/runner/go/pkg/mod/github.com/stretchr/testify@v1.7.5/suite/suite.go:161 +0x252
            panic({0x19b1e20, 0x322f530})
            	/opt/hostedtoolcache/go/1.18.3/x64/src/runtime/panic.go:838 +0x[207](https://github.com/umee-network/umee/runs/7083806789?check_suite_focus=true#step:6:208)
            github.com/umee-network/umee/v2/x/leverage/keeper.Keeper.SetTokenSettings({{0x24fd788, 0xc0010562b0}, {0x24db420, 0xc00108c6e0}, {{0x24fb230, 0xc0010562b0}, 0xc00011f410, {0x24db420, 0xc00108c650}, {0x24db470, ...}, ...}, ...}, ...)

Is there something in SetTokenSetting that needs to be initialized?

@robert-zaremba
Copy link
Copy Markdown
Contributor Author

Probably keeper is not initialized correctly. Checking it.

BTW, TestSimTestSuite/TestSimulateMsgBorrowAsset is not a unit test.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #1068 (227a0b3) into main (6c32f68) will increase coverage by 0.02%.
The diff coverage is 89.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1068      +/-   ##
==========================================
+ Coverage   43.30%   43.32%   +0.02%     
==========================================
  Files          65       65              
  Lines        8371     8383      +12     
==========================================
+ Hits         3625     3632       +7     
- Misses       4498     4502       +4     
- Partials      248      249       +1     
Impacted Files Coverage Δ
x/leverage/keeper/keeper.go 45.75% <84.61%> (+0.06%) ⬆️
x/leverage/keeper/token.go 70.90% <100.00%> (-0.52%) ⬇️

@robert-zaremba robert-zaremba merged commit 932962f into main Jun 28, 2022
@robert-zaremba robert-zaremba deleted the robert/token-cache branch June 28, 2022 16:26
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.

Add cache to the token registry

4 participants