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

refactor(ecocredit/basket): wire core submodule into baskets #935

Merged
merged 24 commits into from
Mar 31, 2022

Conversation

technicallyty
Copy link
Contributor

@technicallyty technicallyty commented Mar 24, 2022

Description

  • integrates the core submodule into baskets

this PR also comments out the integration test for baskets as it is currently broken until we fully wire everything together (#898). Currently the app is setup to deal with v1alpha1 params, whereas the new submodules are wired in for v1.

Closes: #926

Closes: #925


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
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • 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 ! in the type prefix if API or client breaking change
  • 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)

x/ecocredit/core/params.go Show resolved Hide resolved
x/ecocredit/server/basket/create_test.go Show resolved Hide resolved
x/ecocredit/server/basket/take_test.go Outdated Show resolved Hide resolved
@technicallyty technicallyty marked this pull request as ready for review March 25, 2022 17:39
@technicallyty
Copy link
Contributor Author

might have to comment out sims temporarily, i believe aleem is working on integration of sims

@codecov
Copy link

codecov bot commented Mar 25, 2022

Codecov Report

Merging #935 (fa41a8b) into master (29c8666) will decrease coverage by 0.07%.
The diff coverage is 40.86%.

❗ Current head fa41a8b differs from pull request most recent head 8969e84. Consider uploading reports for the commit 8969e84 to get more accurate results

@@            Coverage Diff             @@
##           master     #935      +/-   ##
==========================================
- Coverage   72.96%   72.89%   -0.08%     
==========================================
  Files         197      196       -1     
  Lines       23380    23050     -330     
==========================================
- Hits        17060    16802     -258     
+ Misses       4990     4946      -44     
+ Partials     1330     1302      -28     
Flag Coverage Δ
experimental-codecov 72.71% <40.86%> (-0.15%) ⬇️
stable-codecov 67.70% <40.86%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

app/sim_test.go Outdated Show resolved Hide resolved
Copy link
Member

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Looking good.

The code coverage diff has dropped with param validation but given this is copy paste and we are planning to update to new params, I think that's ok for now.

Let's comment out the lines suggested rather than the whole simulation test and we can renable when updated.

A few small suggestions otherwise and a question about the commented out basket scenario, i.e. what's missing before we can re-enable?

proto/regen/ecocredit/v1/types.proto Outdated Show resolved Hide resolved
x/ecocredit/server/basket/create_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/create_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/put_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/take_test.go Outdated Show resolved Hide resolved
require.NoError(err)
require.Equal(creditsToDeposit.String(), cbRes.RetiredAmount)
}
// TODO: reimpl after full submodule integration
Copy link
Member

Choose a reason for hiding this comment

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

What items are missing before full submodule integration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

params, ops/sims. this test was failing since i started using core.Params, and the integration test/app is wired up for v1alpha params

Copy link
Member

Choose a reason for hiding this comment

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

This is not ideal but we can handle in a separate pull request when we refactor tests #728.

x/ecocredit/server/basket/take_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/put_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/put_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/put_test.go Outdated Show resolved Hide resolved
@ryanchristo ryanchristo changed the title chore(ecocredit/basket): wire core submodule into baskets refactor(ecocredit/basket): wire core submodule into baskets Mar 28, 2022
Copy link
Member

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Looking good. A few comments and suggestions.

proto/regen/ecocredit/v1/types.proto Outdated Show resolved Hide resolved
x/ecocredit/core/params.go Show resolved Hide resolved
x/ecocredit/server/basket/create_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/create_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/create_test.go Show resolved Hide resolved
x/ecocredit/server/basket/create_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/create_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/put.go Outdated Show resolved Hide resolved
x/ecocredit/server/basket/take_test.go Outdated Show resolved Hide resolved
@@ -212,3 +206,88 @@ func (k Keeper) addCreditBalance(ctx context.Context, owner sdk.AccAddress, batc
})
}
}

func (k Keeper) addAndSaveBalance(ctx context.Context, user sdk.AccAddress, batchId uint64, amount math.Dec) error {
Copy link
Member

Choose a reason for hiding this comment

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

should some of these be helper functions in core?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah that would make more sense. added to core/utils, will merge now

@technicallyty technicallyty enabled auto-merge (squash) March 31, 2022 19:54
@technicallyty technicallyty merged commit f39b517 into master Mar 31, 2022
@technicallyty technicallyty deleted the ty/rewire_basket branch March 31, 2022 19:55
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.

baskets: integrate core submodule baskets: credit types are not checked in allowed classes
4 participants