tendermint / spn

A blockchain to launch blockchains.
Other
112 stars 41 forks source link

feat(`claim`): add hooks for delegation and vote mission claim #871

Closed lumtis closed 2 years ago

lumtis commented 2 years ago

Implement hooks for staking and gov modules that allow to complete claim mission on the events:

Set hooks in app.go as a sample implementation.

Security mechanism remains to be designed: locking a specific mission ID for a specific module

Add event on mission completion

To test:

Serve:

ignite chain serve -r

Claim for delegation mission:

spnd tx staking delegate spnvaloper1ezptsm3npn54qx9vvpah4nymre59ykr9mx22g4 1500uspn --from bob -y

Claim for voting proposal:

spnd tx gov submit-proposal cancel-software-upgrade --title foo --description bar --from alice -y
spnd tx gov deposit 1 1uspn --from alice -y
spnd tx gov vote 1 yes --from bob -y

Check balance for drop token:

spnd q bank balances spn1aqn8ynvr3jmq67879qulzrwhchq5dtrvtx0nhe

Check claim records:

spnd q claim list-claim-record
codecov[bot] commented 2 years ago

Codecov Report

Merging #871 (8c7a657) into develop (6bbb406) will decrease coverage by 0.02%. The diff coverage is 3.19%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #871      +/-   ##
===========================================
- Coverage    10.42%   10.39%   -0.03%     
===========================================
  Files          322      325       +3     
  Lines        75407    75688     +281     
===========================================
+ Hits          7862     7869       +7     
- Misses       67356    67630     +274     
  Partials       189      189              
Impacted Files Coverage Δ
x/claim/keeper/mission_delegation_hooks.go 0.00% <0.00%> (ø)
x/claim/keeper/mission_vote_hooks.go 0.00% <0.00%> (ø)
x/claim/types/events.pb.go 1.18% <1.18%> (ø)
x/claim/keeper/mission.go 96.20% <100.00%> (+0.25%) :arrow_up:
x/campaign/simulation/store.go 82.43% <0.00%> (-0.68%) :arrow_down:
Pantani commented 2 years ago

the simulation test is broken

lumtis commented 2 years ago

Yep there was a bug! Not sure why it was only triggered in simulation and not on serve