-
Notifications
You must be signed in to change notification settings - Fork 57
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
fix: last updated setting in x/marketmap
keeper [DO NOT MERGE]
#799
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #799 +/- ##
==========================================
+ Coverage 57.39% 57.40% +0.01%
==========================================
Files 214 214
Lines 14844 14850 +6
==========================================
+ Hits 8520 8525 +5
Misses 5710 5710
- Partials 614 615 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments. Let's chat about how this change and how it is integrated tomorrow.
tests/integration/connect_setup.go
Outdated
// create the mm client | ||
client := mmtypes.NewQueryClient(cc) | ||
|
||
ctx := context.Background() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is only used in tests, but can we just pass a ctx to this function and use it. Ideally a context is defined at the beginning of tests that we can use, and it looks like there is a context for us to use in this case, so we should avoid creating this context if possible.
tests/integration/connect_setup.go
Outdated
if err != nil { | ||
return err | ||
} | ||
|
||
if resp.TxResult.Code != abcitypes.CodeTypeOK { | ||
return fmt.Errorf(resp.TxResult.Log) | ||
if txResp.TxResult.Code != abcitypes.CodeTypeOK { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do proposals pass immediately with interchaintest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but the result of a proposal or submitted Tx will be TypeOK if it landed successfully
@@ -89,7 +89,18 @@ func (k *Keeper) GetMarket(ctx context.Context, tickerStr string) (types.Market, | |||
|
|||
// setMarket sets a market. | |||
func (k *Keeper) setMarket(ctx context.Context, market types.Market) error { | |||
return k.markets.Set(ctx, types.TickerString(market.Ticker.String()), market) | |||
if err := k.markets.Set(ctx, types.TickerString(market.Ticker.String()), market); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, what are the properties of this cosmos-sdk collections map? Does it handle stuff to ensure things are deterministic? Any idea of the specifics?
@@ -85,7 +85,7 @@ func (ms msgServer) UpsertMarkets(goCtx context.Context, msg *types.MsgUpsertMar | |||
return nil, err | |||
} | |||
|
|||
return &types.MsgUpsertMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) //nolint:gosec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For these functions, SetLastUpdated will not get called many times per upsert potentially. Are there gas consequences of this? Is that a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are gas consequences because it is called many times yes.
This isn't a problem per-se as these transactions are only executed by gov / the mmu auth, but it is another reason why this PR is state breaking
x/marketmap
keeperx/marketmap
keeper [DO NOT MERGE]
Closes CON-1839
SetLastUpdated
for anySet
orRemove
calls in the keeper. (previously these calls were only done during the MsgServer which meant that hooks, or any keeper calls that are not part of a MsgServer call were not updating LastUpdated)LastUpdated
field. Use randomized blockheights instead of constantsNote, this fix is only for on-chain code, so a full upgrade would be needed. This is also state-breaking, so we will need to make a new
v3.x
release as anyv1
orv2
version of the code will result in disparate states (last updated will be updated differently).I will make another PR that will only updates the sidecar, which can be rolled out more quickly.