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

Initial stake module specs #5

Merged
merged 2 commits into from
Apr 30, 2020
Merged

Initial stake module specs #5

merged 2 commits into from
Apr 30, 2020

Conversation

shanev
Copy link
Member

@shanev shanev commented Apr 24, 2020

Fixes #3.

This wraps the Cosmos x/staking module, making delegations unbond after a certain period of time.

Storing delegations with a key tuple of expire_time | post_id | stake_id in a FIFO queue.

post_id: tweet id
stake_id: auto-incrementing uint64 for each like

This allows the end blocker to only peek the first element on each block. Then it can get all stakes for a post by iterating on expire_time | post_id , and pop each element when processed. So only currently active stakes are stored on chain.

It will be the duty of the the indexer to keep track of stake and tweet relationships long-term.

@shanev shanev self-assigned this Apr 24, 2020
@shanev shanev force-pushed the stake-specs branch 2 times, most recently from fea3c42 to 3158001 Compare April 30, 2020 00:17
@shanev shanev marked this pull request as ready for review April 30, 2020 00:21
@shanev shanev changed the title Stake specs Initial stake module specs Apr 30, 2020
Copy link
Member

@jhernandezb jhernandezb left a comment

Choose a reason for hiding this comment

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

Looks good to me, just have one thought.

Is it maybe too soon to add a vendor_id ? like
DelegationQueue: 0x01 | format(expire_time) | vendor_id | post_id | stake_id -> Delegation

@shanev
Copy link
Member Author

shanev commented Apr 30, 2020

Looks good to me, just have one thought.

Is it maybe too soon to add a vendor_id ? like
DelegationQueue: 0x01 | format(expire_time) | vendor_id | post_id | stake_id -> Delegation

Excellent point. Added vendor_id.

@shanev shanev merged commit e9fbb19 into master Apr 30, 2020
@shanev shanev deleted the stake-specs branch April 30, 2020 18:40
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.

Stake module specs
2 participants