-
Notifications
You must be signed in to change notification settings - Fork 334
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
[contract_indexer] fix transfer event handling #3887
Conversation
8b95e35
to
3340c2b
Compare
Codecov Report
@@ Coverage Diff @@
## master #3887 +/- ##
==========================================
+ Coverage 75.38% 75.39% +0.01%
==========================================
Files 303 328 +25
Lines 25923 27812 +1889
==========================================
+ Hits 19541 20968 +1427
- Misses 5360 5767 +407
- Partials 1022 1077 +55
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -434,7 +434,15 @@ func (eh *contractStakingEventHandler) handleTransferEvent(event eventParam) err | |||
return err | |||
} | |||
|
|||
eh.tokenOwner[tokenID.Uint64()] = to |
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.
same issue on L507?
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.
yes, please do a complete revisit of all the handlers, see if there are other places need to cover
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.
only handleTransferEvent
need to update
@@ -434,7 +434,15 @@ func (eh *contractStakingEventHandler) handleTransferEvent(event eventParam) err | |||
return err | |||
} | |||
|
|||
eh.tokenOwner[tokenID.Uint64()] = to | |||
token := tokenID.Uint64() |
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.
token
-> tokenID
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.
fixed
@@ -1715,6 +1715,62 @@ func TestContractStaking(t *testing.T) { | |||
r.True(ok) | |||
r.EqualValues(identityset.Address(delegateIdx).String(), bt.Candidate.String()) | |||
}) | |||
|
|||
t.Run("transfer token", func(t *testing.T) { |
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.
as we discussed, every newly added funcs/APIs should be covered by a test
8452f22
to
5b99895
Compare
SonarCloud Quality Gate failed.
|
Description
Currently, only the transfer events triggered during the creation of a bucket are being handled. The transfer events triggered during subsequent bucket transfers are not being handled correctly.
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: