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

feat: handle withdrawn status #43

Merged
merged 14 commits into from
Nov 14, 2024
Merged

Conversation

gusin13
Copy link
Collaborator

@gusin13 gusin13 commented Nov 13, 2024

Fixes - #8

This pr subscribes to spend notifications of staking tx or unbonding tx then performs checks to identify if the spending tx is a withdrawal tx and marks the status as "Withdrawn".

The handling of spend notification is taken from phase 1 indexer code ref

@gusin13 gusin13 marked this pull request as ready for review November 13, 2024 09:04
@gusin13 gusin13 force-pushed the gusin13/handle-withdrawn-delegation branch from 9c91b76 to e0901dd Compare November 14, 2024 07:00
@@ -81,7 +78,7 @@ func (s *Service) sendUnbondingDelegationEvent(ctx context.Context, delegation *
uint64(delegation.StartHeight),
uint64(delegation.EndHeight),
delegation.UnbondingTx,
delegation.UnbondingTime,
"",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you remind me the value of this unbondingTime? is it the timelock or the final height in which the unbonding tx timelock will expire?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unbondingTime is basically the unbonding timelock (if the staker does early unbonding)

the indexer is not pushing correct data to the api queues (there is some empty strings or dummy stuff) this needs fixing once schema is finalized

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's good you reminded, logged an issue about the queue schema
#45

// Get delegation details
delegation, err := s.getDelegationDetails(ctx, unbondedEarlyEvent.StakingTxHash)
if err != nil {
return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: It might be worth adding a log or appending error messages to make it easier to locate the issue when an error is thrown. The same applies to the other instances of return err in the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point, this have to improved in lot of places.

can work on it in a separate pr, logged a ticket for now #46

@gusin13 gusin13 merged commit 421becc into main Nov 14, 2024
11 checks passed
@gusin13 gusin13 deleted the gusin13/handle-withdrawn-delegation branch November 14, 2024 10:46
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.

2 participants