Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
envestcc committed Jun 26, 2024
1 parent 9f4fdc9 commit a5a4d79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
9 changes: 1 addition & 8 deletions action/protocol/staking/vote_reviser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ func TestVoteRevise_CorrectEndorsement(t *testing.T) {
r.NoError(csm.Upsert(&Candidate{Name: "cand3", SelfStakeBucketIdx: 2, SelfStake: unit.ConvertIotxToRau(1200000), Votes: CalculateVoteWeight(revise.cfg.VoteWeight, buckets[2], true), Owner: identityset.Address(3), Operator: identityset.Address(14), Reward: identityset.Address(12), Identifier: identityset.Address(3)}))
r.NoError(csm.Upsert(&Candidate{Name: "cand4", SelfStakeBucketIdx: 3, SelfStake: unit.ConvertIotxToRau(1200000), Votes: CalculateVoteWeight(revise.cfg.VoteWeight, buckets[3], true), Owner: identityset.Address(4), Operator: identityset.Address(15), Reward: identityset.Address(12), Identifier: identityset.Address(4)}))
// correct endorsement
r.True(revise.NeedRevise(2))
r.NoError(revise.Revise(protocol.MustGetFeatureCtx(ctx), csm, 2))
// verify
t.Run("keep endorsed", func(t *testing.T) {
Expand All @@ -309,14 +310,6 @@ func TestVoteRevise_CorrectEndorsement(t *testing.T) {
r.ErrorIs(err, state.ErrStateNotExist)
})
})
t.Run("correct selfstake height", func(t *testing.T) {
revise := NewVoteReviser(ReviseConfig{
SelfStakeBucketReviseHeight: 1,
})
r.False(revise.shouldReviseSelfStakeBuckets(0))
r.True(revise.shouldReviseSelfStakeBuckets(1))
r.False(revise.shouldReviseSelfStakeBuckets(2))
})
t.Run("correct candidate selfstake", func(t *testing.T) {
ctrl := gomock.NewController(t)
g := deepcopy.Copy(genesis.Default).(genesis.Genesis)
Expand Down
7 changes: 4 additions & 3 deletions chainservice/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,10 @@ func (builder *Builder) registerStakingProtocol() error {
PersistStakingPatchBlock: builder.cfg.Chain.PersistStakingPatchBlock,
StakingPatchDir: builder.cfg.Chain.StakingPatchDir,
Revise: staking.ReviseConfig{
VoteWeight: builder.cfg.Genesis.VoteWeightCalConsts,
ReviseHeights: []uint64{builder.cfg.Genesis.GreenlandBlockHeight, builder.cfg.Genesis.HawaiiBlockHeight},
CorrectCandsHeight: builder.cfg.Genesis.OkhotskBlockHeight,
VoteWeight: builder.cfg.Genesis.VoteWeightCalConsts,
ReviseHeights: []uint64{builder.cfg.Genesis.GreenlandBlockHeight, builder.cfg.Genesis.HawaiiBlockHeight},
CorrectCandsHeight: builder.cfg.Genesis.OkhotskBlockHeight,
SelfStakeBucketReviseHeight: builder.cfg.Genesis.UpernavikBlockHeight,
},
},
builder.cs.candBucketsIndexer,
Expand Down

0 comments on commit a5a4d79

Please sign in to comment.