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

fix: batch balances which didn't always correspond to batches on portfolio ecocredits table #1979

Merged
merged 2 commits into from
Jul 26, 2023

Conversation

blushi
Copy link
Member

@blushi blushi commented Jul 24, 2023

Description

Closes: #1950


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...

  • provided a link to the relevant issue or specification
  • provided instructions on how to test
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

How to test

Use our testing account regen1df675r9vnf7pdedn4sf26svdsem3ugavgxmy46
Go to https://dev.app.regen.network/ecocredits/portfolio, on the ecocredits table last page (), you should see you have some tradable credits for C01-001-20170607-20220622-022, while your tradable balance for this batch is 0: http://redwood.regen.network:1317/regen/ecocredit/v1/balances/regen1df675r9vnf7pdedn4sf26svdsem3ugavgxmy46
Go to https://deploy-preview-1979--regen-registry.netlify.app/ecocredits/portfolio, you shouldn't see any row for C01-001-20170607-20220622-022 anymore.

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 all author checklist items have been addressed
  • reviewed code correctness and readability
  • verified React components follow DRY principles
  • reviewed documentation is accurate
  • reviewed tests
  • manually tested (if applicable)

@netlify
Copy link

netlify bot commented Jul 24, 2023

Deploy Preview for regen-website ready!

Name Link
🔨 Latest commit c32594a
🔍 Latest deploy log https://app.netlify.com/sites/regen-website/deploys/64bf7a0b40e0120008d03bf0
😎 Deploy Preview https://deploy-preview-1979--regen-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@blushi blushi changed the title fix: batch balances which didn't always correspond to batch ids on portfolio ecocredits table fix: batch balances which didn't always correspond to batches on portfolio ecocredits table Jul 24, 2023
@blushi blushi requested a review from a team July 24, 2023 11:12
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.

I wasn't able to find the mnemonic for the test account mentioned in how to test but I did find the mnemonics for a couple other test accounts and sent some credits from one of those accounts to the other to manually test. Unfortunately it looks like there is another issue related to how regen ledger updates balances that were previously a decimal value.

{
"address": "regen1m0qh5y4ejkz3l5n6jlrntxcqx9r0x9xjv4vpcp",
"batch_denom": "C22-001-20190116-20200116-030",
"tradable_amount": "0.000",
"retired_amount": "0",
"escrowed_amount": "0"
},

This still shows up in the deploy preview given 0.000 is not 0 and therefore not filtered. This would be solved on the ledger by pruning the balance (i.e. regen-network/regen-ledger#1889). Not sure how we want to handle this in the meantime but seems like we might need to update the filters to account for zeros being included after the decimal point.

Screenshot from 2023-07-24 10-50-44

Screenshot from 2023-07-24 10-50-29

@blushi
Copy link
Member Author

blushi commented Jul 25, 2023

Nice catch, I wasn't aware of the different formats! Are we always expecting 3 decimals or none? or it could also be in between, like "0.0" or "0.00" for instance?
In any case, probably best to just convert the string to a number and filter 0 values...

@blushi
Copy link
Member Author

blushi commented Jul 25, 2023

Now fixed: https://deploy-preview-1979--regen-registry.netlify.app/ecocredits/accounts/regen1m0qh5y4ejkz3l5n6jlrntxcqx9r0x9xjv4vpcp/portfolio

@blushi blushi requested a review from ryanchristo July 25, 2023 07:40
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.

tACK

@blushi blushi merged commit 1e4319f into dev Jul 26, 2023
14 checks passed
@blushi blushi deleted the fix-1950-batch-balance branch July 26, 2023 06:39
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.

Credit Batch Balance Doesn't Correspond to Batch-ID and Fails to Send
3 participants