-
Notifications
You must be signed in to change notification settings - Fork 356
Fix Staking #4736
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
base: master
Are you sure you want to change the base?
Fix Staking #4736
Conversation
|
} | ||
voteView struct { | ||
indexer staking.ContractStakingIndexer | ||
config *VoteViewConfig |
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.
config VoteViewConfig
h, buckets, err := s.indexer.ContractStakingBuckets() | ||
if err != nil { | ||
return err | ||
} | ||
blkCtx := protocol.MustGetBlockCtx(ctx) | ||
if s.indexer.StartHeight() <= blkCtx.BlockHeight && h != blkCtx.BlockHeight-1 { | ||
return errors.Errorf("bucket cache height %d does not match current height %d", h, blkCtx.BlockHeight-1) | ||
} |
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.
buckets, err := s.buckets(ctx)
if err != nil {
return err
}
|
||
func (cv *candidateVotes) Serialize() ([]byte, error) { | ||
cl := stakingpb.CandidateList{} | ||
for cand, c := range cv.cands { |
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.
sort by key, just in case
|
||
t.Run("success", func(t *testing.T) { | ||
amount := big.NewInt(400) | ||
remaining := bucket.StakedAmount.Sub(bucket.StakedAmount, amount) |
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.
remaining := new(big.Int).Sub(bucket.StakedAmount, amount)
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
based on #4729
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: