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

[bank]: add balance tracking events #8656

Merged
merged 27 commits into from
Feb 25, 2021
Merged

Conversation

fdymylja
Copy link
Contributor

@fdymylja fdymylja commented Feb 22, 2021

Description

This PR includes a state breaking change in events.

Specifically, there's the introduction of four new events which serve the purpose of tracking balance and supply changes.

  • coin_spent: emitted every time a balance decreases (might be fees, burn because some balance decreases, coin send etc)
  • coin_received: emitted every time a balance increases (coin send, mint because some balance increases, etc)
  • coinbase: emitted when supply is increased
  • burn: emitted when supply reduces

These events allow for full balance and supply tracking in the sdk, both in deliver tx, begin and endblock.

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@jgimeno jgimeno linked an issue Feb 22, 2021 that may be closed by this pull request
7 tasks
@codecov
Copy link

codecov bot commented Feb 22, 2021

Codecov Report

Merging #8656 (ea4927a) into master (5d3f29b) will decrease coverage by 0.01%.
The diff coverage is 51.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8656      +/-   ##
==========================================
- Coverage   61.37%   61.36%   -0.02%     
==========================================
  Files         670      671       +1     
  Lines       38286    38324      +38     
==========================================
+ Hits        23499    23516      +17     
- Misses      12329    12350      +21     
  Partials     2458     2458              
Impacted Files Coverage Δ
x/bank/types/events.go 0.00% <0.00%> (ø)
x/bank/keeper/view.go 88.60% <71.42%> (-0.87%) ⬇️
x/bank/keeper/send.go 75.00% <88.88%> (+1.36%) ⬆️
x/bank/keeper/keeper.go 73.96% <92.30%> (+1.46%) ⬆️

@fdymylja fdymylja added T: State Machine Breaking State machine breaking changes (impacts consensus). C:x/bank labels Feb 25, 2021
x/bank/keeper/send.go Outdated Show resolved Hide resolved
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

utACK. Can you amend the spec/events file to contain the new events.

were you able to test this locally on a network?

@alessio
Copy link
Contributor

alessio commented Feb 25, 2021

@marbar3778 I don't think we tested it already on a simd testnet, but we'll give @helder-moreira a shout shortly. And let us know if you want to check something out once the network is up and running!

@fdymylja I think there are a few linter warnings that should be fixed

@fdymylja
Copy link
Contributor Author

utACK. Can you amend the spec/events file to contain the new events.

on it

were you able to test this locally on a network?

tested locally, works for begin block, endblock events and normal txs with one or multiple messages (even when balance changes happen during ante handlers execution)

@fdymylja
Copy link
Contributor Author

@alessio, @marbar3778

I've addressed the requested changes, please let me know if you feel there is anything else that needs to be adjusted

@tac0turtle
Copy link
Member

tac0turtle commented Feb 25, 2021

thank you! looks good to me. Would be nice to test locally or on a server but shouldnt be a blocker

@tac0turtle tac0turtle requested a review from anilcse February 25, 2021 17:04
@alessio alessio added the A:automerge Automatically merge PR once all prerequisites pass. label Feb 25, 2021
@mergify mergify bot merged commit ef9968d into master Feb 25, 2021
@mergify mergify bot deleted the fdymylja/balance-tracking-events branch February 25, 2021 18:15
@alessio
Copy link
Contributor

alessio commented Feb 25, 2021

FTR @marbar3778 @fdymylja testing happens here:

RPC: https://simapp.app.alpha.starport.cloud/ or https://rpc.simapp.app.alpha.starport.cloud/
REST: https://rest.simapp.app.alpha.starport.cloud/
gRPC: https://grpc.simapp.app.alpha.starport.cloud/
p2p: 059821558fd8e04ff56084524e37ec7d5a3f497f@35.237.240.117:30843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:x/bank T: Client UX T: State Machine Breaking State machine breaking changes (impacts consensus).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Rosetta API
3 participants