From a1b253d42261366bb623674f0b611d4cf49df885 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Thu, 12 Sep 2024 17:38:00 +0800 Subject: [PATCH] fix jailed fp get voting power in next delegation --- proto/babylon/btcstaking/v1/incentive.proto | 3 + x/btcstaking/keeper/power_dist_change.go | 12 +- x/btcstaking/keeper/power_dist_change_test.go | 37 +++++- .../keeper/voting_power_table_test.go | 2 +- x/btcstaking/types/btcstaking.go | 10 +- x/btcstaking/types/incentive.go | 5 +- x/btcstaking/types/incentive.pb.go | 118 ++++++++++++------ 7 files changed, 141 insertions(+), 46 deletions(-) diff --git a/proto/babylon/btcstaking/v1/incentive.proto b/proto/babylon/btcstaking/v1/incentive.proto index f849745e8..6f69a7fcf 100644 --- a/proto/babylon/btcstaking/v1/incentive.proto +++ b/proto/babylon/btcstaking/v1/incentive.proto @@ -39,6 +39,9 @@ message FinalityProviderDistInfo { // is_timestamped indicates whether the finality provider // has timestamped public randomness committed bool is_timestamped = 6; + // is_jailed indicates whether the finality provider + // is jailed, if so, it should not be assigned voting power + bool is_jailed = 7; } // BTCDelDistInfo contains the information related to reward distribution for a BTC delegation diff --git a/x/btcstaking/keeper/power_dist_change.go b/x/btcstaking/keeper/power_dist_change.go index d125b5186..db7bcd5ea 100644 --- a/x/btcstaking/keeper/power_dist_change.go +++ b/x/btcstaking/keeper/power_dist_change.go @@ -91,11 +91,17 @@ func (k Keeper) recordVotingPowerAndCache(ctx context.Context, prevDc, newDc *ty // label fps with whether it has timestamped pub rand so that these fps // will not be assigned voting power - for _, fp := range newDc.FinalityProviders { + for _, fpDistInfo := range newDc.FinalityProviders { // TODO calling HasTimestampedPubRand potentially iterates - // all the pub rand committed by the fp, which might slow down + // all the pub rand committed by the fpDistInfo, which might slow down // the process, need optimization - fp.IsTimestamped = k.FinalityKeeper.HasTimestampedPubRand(ctx, fp.BtcPk, babylonTipHeight) + fpDistInfo.IsTimestamped = k.FinalityKeeper.HasTimestampedPubRand(ctx, fpDistInfo.BtcPk, babylonTipHeight) + + fp, err := k.GetFinalityProvider(ctx, fpDistInfo.BtcPk.MustMarshal()) + if err != nil { + panic(fmt.Errorf("the finality provider %s does not exist: %w", fp.BtcPk.MarshalHex(), err)) + } + fpDistInfo.IsJailed = fp.IsJailed() } // apply the finality provider voting power dist info to the new cache diff --git a/x/btcstaking/keeper/power_dist_change_test.go b/x/btcstaking/keeper/power_dist_change_test.go index cd4bb6470..8513af4c6 100644 --- a/x/btcstaking/keeper/power_dist_change_test.go +++ b/x/btcstaking/keeper/power_dist_change_test.go @@ -218,9 +218,9 @@ func FuzzJailFinalityProviderEvents(f *testing.F) { require.ErrorIs(t, err, types.ErrFpAlreadyJailed) // ensure the jailed label is set - fpAfter, err := h.BTCStakingKeeper.GetFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + fpAfterJailing, err := h.BTCStakingKeeper.GetFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) h.NoError(err) - require.True(t, fpAfter.IsJailed()) + require.True(t, fpAfterJailing.IsJailed()) // at this point, there should be only 1 event that the finality provider is jailed btcTipHeight := btclcKeeper.GetTipInfo(h.Ctx).Height @@ -239,6 +239,39 @@ func FuzzJailFinalityProviderEvents(f *testing.F) { h.NoError(err) // ensure the finality provider does not have voting power anymore require.Zero(t, h.BTCStakingKeeper.GetVotingPower(h.Ctx, *fp.BtcPk, babylonHeight)) + + /* + insert another active BTC delegation and check whether the jailed + fp has voting power + */ + stakingValue = int64(2 * 10e8) + _, _, _, msgCreateBTCDel, actualDel = h.CreateDelegation( + r, + fpPK, + changeAddress.EncodeAddress(), + stakingValue, + 1000, + ) + // give it a quorum number of covenant signatures + msgs = h.GenerateCovenantSignaturesMessages(r, covenantSKs, msgCreateBTCDel, actualDel) + for i := 0; i < int(h.BTCStakingKeeper.GetParams(h.Ctx).CovenantQuorum); i++ { + _, err = h.MsgServer.AddCovenantSigs(h.Ctx, msgs[i]) + h.NoError(err) + } + + // execute BeginBlock + btcTip = btclcKeeper.GetTipInfo(h.Ctx) + babylonHeight += 1 + h.SetCtxHeight(babylonHeight) + h.BTCLightClientKeeper.EXPECT().GetTipInfo(gomock.Eq(h.Ctx)).Return(btcTip).AnyTimes() + err = h.BTCStakingKeeper.BeginBlocker(h.Ctx) + h.NoError(err) + // ensure the finality provider is not jailed and has voting power at this height + + fpAfterJailing, err = h.BTCStakingKeeper.GetFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + h.NoError(err) + require.True(t, fpAfterJailing.IsJailed()) + require.Equal(t, uint64(0), h.BTCStakingKeeper.GetVotingPower(h.Ctx, *fp.BtcPk, babylonHeight)) }) } diff --git a/x/btcstaking/keeper/voting_power_table_test.go b/x/btcstaking/keeper/voting_power_table_test.go index a76ee2e82..ff4089ef0 100644 --- a/x/btcstaking/keeper/voting_power_table_test.go +++ b/x/btcstaking/keeper/voting_power_table_test.go @@ -209,7 +209,7 @@ func FuzzVotingPowerTable_ActiveFinalityProviders(f *testing.F) { maxActiveFpsParam := h.BTCStakingKeeper.GetParams(h.Ctx).MaxActiveFinalityProviders // get a map of expected active finality providers - types.SortFinalityProvidersWithTimestamping(fpsWithMeta) + types.SortFinalityProvidersWithTimestampingAndJailing(fpsWithMeta) expectedActiveFps := fpsWithMeta[:min(uint32(len(fpsWithMeta)-len(noTimestampedFps)), maxActiveFpsParam)] expectedActiveFpsMap := map[string]uint64{} for _, fp := range expectedActiveFps { diff --git a/x/btcstaking/types/btcstaking.go b/x/btcstaking/types/btcstaking.go index b0b9648c7..f3e2bbd64 100644 --- a/x/btcstaking/types/btcstaking.go +++ b/x/btcstaking/types/btcstaking.go @@ -42,11 +42,11 @@ func (fp *FinalityProvider) ValidateBasic() error { return nil } -// SortFinalityProvidersWithTimestamping sorts the finality providers slice, +// SortFinalityProvidersWithTimestampingAndJailing sorts the finality providers slice, // from higher to lower voting power // finality providers that are timestamped come higher than // those are not -func SortFinalityProvidersWithTimestamping(fps []*FinalityProviderDistInfo) { +func SortFinalityProvidersWithTimestampingAndJailing(fps []*FinalityProviderDistInfo) { sort.SliceStable(fps, func(i, j int) bool { if fps[i].IsTimestamped && !fps[j].IsTimestamped { return true @@ -54,6 +54,12 @@ func SortFinalityProvidersWithTimestamping(fps []*FinalityProviderDistInfo) { if !fps[i].IsTimestamped && fps[j].IsTimestamped { return false } + if !fps[i].IsJailed && fps[j].IsJailed { + return true + } + if fps[i].IsJailed && !fps[j].IsJailed { + return false + } return fps[i].TotalVotingPower > fps[j].TotalVotingPower }) } diff --git a/x/btcstaking/types/incentive.go b/x/btcstaking/types/incentive.go index e6955ee2f..674413d67 100644 --- a/x/btcstaking/types/incentive.go +++ b/x/btcstaking/types/incentive.go @@ -40,7 +40,7 @@ func (dc *VotingPowerDistCache) FindNewActiveFinalityProviders(prevDc *VotingPow // and records them in cache func (dc *VotingPowerDistCache) ApplyActiveFinalityProviders(maxActiveFPs uint32) { // sort finality providers with timestamping considered - SortFinalityProvidersWithTimestamping(dc.FinalityProviders) + SortFinalityProvidersWithTimestampingAndJailing(dc.FinalityProviders) numActiveFPs := uint32(0) @@ -56,6 +56,9 @@ func (dc *VotingPowerDistCache) ApplyActiveFinalityProviders(maxActiveFPs uint32 if !fp.IsTimestamped { break } + if fp.IsJailed { + break + } numActiveFPs++ } diff --git a/x/btcstaking/types/incentive.pb.go b/x/btcstaking/types/incentive.pb.go index e3bfc77fb..b1884734e 100644 --- a/x/btcstaking/types/incentive.pb.go +++ b/x/btcstaking/types/incentive.pb.go @@ -88,6 +88,9 @@ type FinalityProviderDistInfo struct { // is_timestamped indicates whether the finality provider // has timestamped public randomness committed IsTimestamped bool `protobuf:"varint,6,opt,name=is_timestamped,json=isTimestamped,proto3" json:"is_timestamped,omitempty"` + // is_jailed indicates whether the finality provider + // is jailed, if so, it should not be assigned voting power + IsJailed bool `protobuf:"varint,7,opt,name=is_jailed,json=isJailed,proto3" json:"is_jailed,omitempty"` } func (m *FinalityProviderDistInfo) Reset() { *m = FinalityProviderDistInfo{} } @@ -151,6 +154,13 @@ func (m *FinalityProviderDistInfo) GetIsTimestamped() bool { return false } +func (m *FinalityProviderDistInfo) GetIsJailed() bool { + if m != nil { + return m.IsJailed + } + return false +} + // BTCDelDistInfo contains the information related to reward distribution for a BTC delegation type BTCDelDistInfo struct { // btc_pk is the Bitcoin secp256k1 PK of this BTC delegation @@ -229,43 +239,44 @@ func init() { } var fileDescriptor_ac354c3bd6d7a66b = []byte{ - // 565 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0x8d, 0xdb, 0x34, 0x5f, 0x3b, 0xf9, 0xf9, 0x60, 0x14, 0x24, 0x53, 0x24, 0x27, 0x44, 0x04, - 0x65, 0xd1, 0xd8, 0x94, 0x76, 0x01, 0xac, 0xa8, 0x1b, 0x55, 0x54, 0xfc, 0x45, 0x26, 0x62, 0xc1, - 0x02, 0x6b, 0x3c, 0x9e, 0xd8, 0xa3, 0xd8, 0x1e, 0xcb, 0x33, 0x31, 0xc9, 0x1b, 0xb0, 0xe4, 0x11, - 0x78, 0x88, 0x3e, 0x04, 0xcb, 0xa8, 0x2b, 0xd4, 0x45, 0x85, 0x92, 0x05, 0x8f, 0x01, 0xf2, 0x0f, - 0x24, 0xa0, 0x46, 0xea, 0x82, 0xdd, 0xcc, 0x3d, 0xe7, 0xde, 0xb9, 0xe7, 0x1c, 0x0d, 0x68, 0x5b, - 0xc8, 0x9a, 0x7a, 0x2c, 0xd0, 0x2c, 0x81, 0xb9, 0x40, 0x23, 0x1a, 0x38, 0x5a, 0xbc, 0xaf, 0xd1, - 0x00, 0x93, 0x40, 0xd0, 0x98, 0xa8, 0x61, 0xc4, 0x04, 0x83, 0xb7, 0x72, 0x9a, 0xba, 0xa4, 0xa9, - 0xf1, 0xfe, 0x6e, 0xdd, 0x61, 0x0e, 0x4b, 0x19, 0x5a, 0x72, 0xca, 0xc8, 0xbb, 0xb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0x5d, 0x78, 0x17, 0x54, 0xae, 0xf0, 0xb5, 0x1c, - 0x2f, 0x2d, 0xd5, 0x5f, 0x7d, 0x99, 0x2b, 0xd2, 0x6c, 0xae, 0x48, 0xdf, 0xe6, 0x8a, 0xf4, 0x69, - 0xa1, 0x14, 0x66, 0x0b, 0xa5, 0xf0, 0x75, 0xa1, 0x14, 0xde, 0x5d, 0x43, 0xdc, 0x64, 0xf5, 0x8f, - 0xa7, 0x4a, 0xad, 0x52, 0xfa, 0x2b, 0x0f, 0x7e, 0x06, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x88, 0x9d, - 0x74, 0x06, 0x04, 0x00, 0x00, + // 585 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0xdb, 0xf4, 0x6f, 0xfa, 0xf3, 0x7d, 0x8c, 0x8a, 0x64, 0x5a, 0xc9, 0x0d, 0x15, 0x45, + 0x59, 0x34, 0x36, 0xa5, 0x5d, 0x00, 0x2b, 0xea, 0x46, 0x15, 0xe5, 0x37, 0x32, 0x15, 0x0b, 0x16, + 0x58, 0xe3, 0xf1, 0xc4, 0x1e, 0x62, 0x7b, 0x2c, 0xdf, 0x89, 0x69, 0xde, 0x80, 0x25, 0x0f, 0xc0, + 0x82, 0x87, 0xe8, 0x43, 0xb0, 0xac, 0xba, 0x42, 0x5d, 0x54, 0xa8, 0x5d, 0xf0, 0x1a, 0xc8, 0x63, + 0x43, 0x02, 0x6a, 0xa4, 0x2e, 0xd8, 0xf9, 0xde, 0x73, 0xee, 0x9d, 0x39, 0xe7, 0xc8, 0x83, 0x36, + 0x3c, 0xe2, 0x0d, 0x22, 0x91, 0x58, 0x9e, 0xa4, 0x20, 0x49, 0x8f, 0x27, 0x81, 0x95, 0x6f, 0x59, + 0x3c, 0xa1, 0x2c, 0x91, 0x3c, 0x67, 0x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 0xfb, 0xff, 0x7d, 0x28, 0x0f, 0xd1, 0x7c, 0xa1, 0x86, 0x65, 0xee, 0xb5, + 0xb2, 0x41, 0x25, 0xb9, 0x68, 0xe2, 0xbb, 0xe8, 0xbf, 0xca, 0x08, 0x57, 0x1e, 0xb9, 0x21, 0x81, + 0xb0, 0x8c, 0xc9, 0x59, 0xac, 0xda, 0x87, 0x47, 0x4f, 0x08, 0x84, 0xf8, 0x36, 0x5a, 0xb8, 0xc2, + 0xf4, 0xf9, 0x7c, 0xe8, 0xb7, 0xfd, 0xf2, 0xeb, 0x85, 0xa1, 0x9d, 0x5c, 0x18, 0xda, 0xf7, 0x0b, + 0x43, 0xfb, 0x74, 0x69, 0xd4, 0x4e, 0x2e, 0x8d, 0xda, 0xb7, 0x4b, 0xa3, 0xf6, 0xf6, 0x1a, 0xe2, + 0x8e, 0x46, 0x1f, 0x00, 0xa5, 0xd4, 0x9b, 0x56, 0xbf, 0xec, 0xf6, 0xcf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xd8, 0x71, 0x40, 0x06, 0x23, 0x04, 0x00, 0x00, } func (m *VotingPowerDistCache) Marshal() (dAtA []byte, err error) { @@ -335,6 +346,16 @@ func (m *FinalityProviderDistInfo) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l + if m.IsJailed { + i-- + if m.IsJailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } if m.IsTimestamped { i-- if m.IsTimestamped { @@ -514,6 +535,9 @@ func (m *FinalityProviderDistInfo) Size() (n int) { if m.IsTimestamped { n += 2 } + if m.IsJailed { + n += 2 + } return n } @@ -874,6 +898,26 @@ func (m *FinalityProviderDistInfo) Unmarshal(dAtA []byte) error { } } m.IsTimestamped = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsJailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIncentive + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsJailed = bool(v != 0) default: iNdEx = preIndex skippy, err := skipIncentive(dAtA[iNdEx:])