From c0417f0e5ed1923f3198ad9bcaf4f3e1d11131ed Mon Sep 17 00:00:00 2001 From: RafilxTenfen Date: Thu, 19 Dec 2024 11:19:51 -0300 Subject: [PATCH] chore: removed BTC del distribution info structure --- proto/babylon/finality/v1/finality.proto | 21 +- testutil/datagen/incentive.go | 52 +- x/finality/keeper/power_dist_change.go | 50 +- x/finality/keeper/power_table_test.go | 4 - x/finality/types/finality.pb.go | 525 +++---------------- x/finality/types/power_table.go | 25 +- x/incentive/keeper/btc_staking_gauge_test.go | 17 +- 7 files changed, 148 insertions(+), 546 deletions(-) diff --git a/proto/babylon/finality/v1/finality.proto b/proto/babylon/finality/v1/finality.proto index 21f67f837..90623e099 100644 --- a/proto/babylon/finality/v1/finality.proto +++ b/proto/babylon/finality/v1/finality.proto @@ -36,31 +36,16 @@ message FinalityProviderDistInfo { ]; // total_bonded_sat is the total amount of bonded BTC stake (in Satoshi) of the finality provider uint64 total_bonded_sat = 4; - // btc_dels is a list of BTC delegations' voting power information under this finality provider - repeated BTCDelDistInfo btc_dels = 5; // is_timestamped indicates whether the finality provider // has timestamped public randomness committed // if no, it should not be assigned voting power - bool is_timestamped = 6; + bool is_timestamped = 5; // is_jailed indicates whether the finality provider // is jailed, if so, it should not be assigned voting power - bool is_jailed = 7; + bool is_jailed = 6; // is_slashed indicates whether the finality provider // is slashed, if so, it should not be assigned voting power - bool is_slashed = 8; -} - -// BTCDelDistInfo contains the information related to voting power distribution for a BTC delegation -message BTCDelDistInfo { - // btc_pk is the Bitcoin secp256k1 PK of this BTC delegation - // the PK follows encoding in BIP-340 spec - bytes btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; - // staker_addr is the address to receive rewards from BTC delegation. - string staker_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // staking_tx_hash is the staking tx hash of the BTC delegation - string staking_tx_hash = 3; - // total_sat is the amount of BTC stake (in Satoshi) of the BTC delegation - uint64 total_sat = 4; + bool is_slashed = 7; } // IndexedBlock is the necessary metadata and finalization status of a block diff --git a/testutil/datagen/incentive.go b/testutil/datagen/incentive.go index a952f53fc..19c2da45e 100644 --- a/testutil/datagen/incentive.go +++ b/testutil/datagen/incentive.go @@ -78,53 +78,55 @@ func GenRandomGauge(r *rand.Rand) *itypes.Gauge { return itypes.NewGauge(coins...) } -func GenRandomBTCDelDistInfo(r *rand.Rand) (*ftypes.BTCDelDistInfo, error) { - btcPK, err := GenRandomBIP340PubKey(r) - if err != nil { - return nil, err - } - return &ftypes.BTCDelDistInfo{ - BtcPk: btcPK, - StakerAddr: GenRandomAccount().Address, - TotalSat: RandomInt(r, 1000) + 1, - }, nil +func GenRandomAddrAndSat(r *rand.Rand) (string, uint64) { + return GenRandomAccount().Address, RandomInt(r, 1000) + 1 } -func GenRandomFinalityProviderDistInfo(r *rand.Rand) (*ftypes.FinalityProviderDistInfo, error) { +func GenRandomFinalityProviderDistInfo(r *rand.Rand) ( + fpDistInfo *ftypes.FinalityProviderDistInfo, + btcTotalSatByAddress map[string]uint64, + err error, +) { // create finality provider with random commission fp, err := GenRandomFinalityProvider(r) if err != nil { - return nil, err + return nil, nil, err } // create finality provider distribution info - fpDistInfo := ftypes.NewFinalityProviderDistInfo(fp) + fpDistInfo = ftypes.NewFinalityProviderDistInfo(fp) // add a random number of BTC delegation distribution info numBTCDels := RandomInt(r, 100) + 1 + btcTotalSatByAddress = make(map[string]uint64, numBTCDels) for i := uint64(0); i < numBTCDels; i++ { - btcDelDistInfo, err := GenRandomBTCDelDistInfo(r) - if err != nil { - return nil, err - } - fpDistInfo.BtcDels = append(fpDistInfo.BtcDels, btcDelDistInfo) - fpDistInfo.TotalBondedSat += btcDelDistInfo.TotalSat + btcAddr, totalSat := GenRandomAddrAndSat(r) + btcTotalSatByAddress[btcAddr] += totalSat + fpDistInfo.TotalBondedSat += totalSat fpDistInfo.IsTimestamped = true } - return fpDistInfo, nil + return fpDistInfo, btcTotalSatByAddress, nil } -func GenRandomVotingPowerDistCache(r *rand.Rand, maxFPs uint32) (*ftypes.VotingPowerDistCache, error) { - dc := ftypes.NewVotingPowerDistCache() +func GenRandomVotingPowerDistCache(r *rand.Rand, maxFPs uint32) ( + dc *ftypes.VotingPowerDistCache, + // fpAddr => delAddr => totalSat + btcTotalSatByDelAddressByFpAddress map[string]map[string]uint64, + err error, +) { + dc = ftypes.NewVotingPowerDistCache() // a random number of finality providers numFps := RandomInt(r, 10) + 1 + + btcTotalSatByDelAddressByFpAddress = make(map[string]map[string]uint64, numFps) for i := uint64(0); i < numFps; i++ { - v, err := GenRandomFinalityProviderDistInfo(r) + v, btcTotalSatByAddress, err := GenRandomFinalityProviderDistInfo(r) if err != nil { - return nil, err + return nil, nil, err } + btcTotalSatByDelAddressByFpAddress[v.GetAddress().String()] = btcTotalSatByAddress dc.AddFinalityProviderDistInfo(v) } dc.ApplyActiveFinalityProviders(maxFPs) - return dc, nil + return dc, btcTotalSatByDelAddressByFpAddress, nil } func GenRandomCheckpointAddressPair(r *rand.Rand) *btcctypes.CheckpointAddressPair { diff --git a/x/finality/keeper/power_dist_change.go b/x/finality/keeper/power_dist_change.go index 88d3f6ba2..1a669e772 100644 --- a/x/finality/keeper/power_dist_change.go +++ b/x/finality/keeper/power_dist_change.go @@ -175,8 +175,10 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( // a map where key is finality provider's BTC PK hex and value is a list // of BTC delegations that newly become active under this provider activeBTCDels := map[string][]*types.BTCDelegation{} - // a map where key is unbonded BTC delegation's staking tx hash - unbondedBTCDels := map[string]struct{}{} + // a map where key is finality provider's BTC PK hex and value is a list + // of BTC delegations that were unbonded or expired without previously + // being unbonded + unbondedBTCDels := map[string][]*types.BTCDelegation{} // a map where key is slashed finality providers' BTC PK slashedFPs := map[string]struct{}{} // a map where key is jailed finality providers' BTC PK @@ -216,7 +218,11 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( }) case types.BTCDelegationStatus_UNBONDED: // add the unbonded BTC delegation to the map - unbondedBTCDels[delStkTxHash] = struct{}{} + // unbondedBTCDels[delStkTxHash] = struct{}{} + for _, fpBTCPK := range btcDel.FpBtcPkList { + fpBTCPKHex := fpBTCPK.MarshalHex() + unbondedBTCDels[fpBTCPKHex] = append(unbondedBTCDels[fpBTCPKHex], btcDel) + } k.processRewardTracker(ctx, cacheFpByBtcPkHex, btcDel, func(fp, del sdk.AccAddress, sats uint64) { k.MustProcessBtcDelegationUnbonded(ctx, fp, del, sats) }) @@ -226,7 +232,11 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( if !btcDel.IsUnbondedEarly() { // only adds to the new unbonded list if it hasn't // previously unbonded with types.BTCDelegationStatus_UNBONDED - unbondedBTCDels[delStkTxHash] = struct{}{} + // unbondedBTCDels[delStkTxHash] = struct{}{} + for _, fpBTCPK := range btcDel.FpBtcPkList { + fpBTCPKHex := fpBTCPK.MarshalHex() + unbondedBTCDels[fpBTCPKHex] = append(unbondedBTCDels[fpBTCPKHex], btcDel) + } k.processRewardTracker(ctx, cacheFpByBtcPkHex, btcDel, func(fp, del sdk.AccAddress, sats uint64) { k.MustProcessBtcDelegationUnbonded(ctx, fp, del, sats) }) @@ -261,9 +271,6 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( for i := range dc.FinalityProviders { // create a copy of the finality provider fp := *dc.FinalityProviders[i] - fp.TotalBondedSat = 0 - fp.BtcDels = []*ftypes.BTCDelDistInfo{} - fpBTCPKHex := fp.BtcPk.MarshalHex() // if this finality provider is slashed, continue to avoid @@ -289,16 +296,17 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( fp.IsJailed = false } - // add all BTC delegations that are not unbonded to the new finality provider - for j := range dc.FinalityProviders[i].BtcDels { - btcDel := *dc.FinalityProviders[i].BtcDels[j] - - _, isUnbondedBtcDelegation := unbondedBTCDels[btcDel.StakingTxHash] - if isUnbondedBtcDelegation { - continue + // process all new BTC delegations under this finality provider + if fpUnbondedBTCDels, ok := unbondedBTCDels[fpBTCPKHex]; ok { + // handle unbonded delegations for this finality provider + for _, d := range fpUnbondedBTCDels { + fp.UnbondBTCDel(d) } - // if it is not unbonded add to the del dist info - fp.AddBTCDelDistInfo(&btcDel) + // remove the finality provider entry in unbondedBTCDels map, so that + // after the for loop the rest entries in unbondedBTCDels belongs to new + // finality providers that might have btc delegations entries + // that activated and unbonded in the same slice of events + delete(unbondedBTCDels, fpBTCPKHex) } // process all new BTC delegations under this finality provider @@ -343,6 +351,16 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( fpDistInfo.AddBTCDel(d) } + // edge case where we might be processing an unbonded event + // from a newly active finality provider in the same slice + // of events received. + fpUnbondedBTCDels, ok := unbondedBTCDels[fpBTCPKHex] + if ok { + for _, d := range fpUnbondedBTCDels { + fpDistInfo.UnbondBTCDel(d) + } + } + // add this finality provider to the new cache if it has voting power if fpDistInfo.TotalBondedSat > 0 { newDc.AddFinalityProviderDistInfo(fpDistInfo) diff --git a/x/finality/keeper/power_table_test.go b/x/finality/keeper/power_table_test.go index 1da55453f..2b2d14520 100644 --- a/x/finality/keeper/power_table_test.go +++ b/x/finality/keeper/power_table_test.go @@ -246,10 +246,6 @@ func FuzzRecordVotingPowerDistCache(f *testing.F) { fp, ok := fpsWithVotingPowerMap[sdk.AccAddress(fpDistInfo.Addr).String()] require.True(t, ok) require.Equal(t, fpDistInfo.Commission, fp.Commission) - require.Len(t, fpDistInfo.BtcDels, int(numBTCDels)) - for _, delDistInfo := range fpDistInfo.BtcDels { - require.Equal(t, delDistInfo.TotalSat, stakingValue) - } } }) } diff --git a/x/finality/types/finality.pb.go b/x/finality/types/finality.pb.go index 1f7c74471..f8daf23d4 100644 --- a/x/finality/types/finality.pb.go +++ b/x/finality/types/finality.pb.go @@ -88,18 +88,16 @@ type FinalityProviderDistInfo struct { Commission *cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission,omitempty"` // total_bonded_sat is the total amount of bonded BTC stake (in Satoshi) of the finality provider TotalBondedSat uint64 `protobuf:"varint,4,opt,name=total_bonded_sat,json=totalBondedSat,proto3" json:"total_bonded_sat,omitempty"` - // btc_dels is a list of BTC delegations' voting power information under this finality provider - BtcDels []*BTCDelDistInfo `protobuf:"bytes,5,rep,name=btc_dels,json=btcDels,proto3" json:"btc_dels,omitempty"` // is_timestamped indicates whether the finality provider // has timestamped public randomness committed // if no, it should not be assigned voting power - IsTimestamped bool `protobuf:"varint,6,opt,name=is_timestamped,json=isTimestamped,proto3" json:"is_timestamped,omitempty"` + IsTimestamped bool `protobuf:"varint,5,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"` + IsJailed bool `protobuf:"varint,6,opt,name=is_jailed,json=isJailed,proto3" json:"is_jailed,omitempty"` // is_slashed indicates whether the finality provider // is slashed, if so, it should not be assigned voting power - IsSlashed bool `protobuf:"varint,8,opt,name=is_slashed,json=isSlashed,proto3" json:"is_slashed,omitempty"` + IsSlashed bool `protobuf:"varint,7,opt,name=is_slashed,json=isSlashed,proto3" json:"is_slashed,omitempty"` } func (m *FinalityProviderDistInfo) Reset() { *m = FinalityProviderDistInfo{} } @@ -149,13 +147,6 @@ func (m *FinalityProviderDistInfo) GetTotalBondedSat() uint64 { return 0 } -func (m *FinalityProviderDistInfo) GetBtcDels() []*BTCDelDistInfo { - if m != nil { - return m.BtcDels - } - return nil -} - func (m *FinalityProviderDistInfo) GetIsTimestamped() bool { if m != nil { return m.IsTimestamped @@ -177,73 +168,6 @@ func (m *FinalityProviderDistInfo) GetIsSlashed() bool { return false } -// BTCDelDistInfo contains the information related to voting power distribution for a BTC delegation -type BTCDelDistInfo struct { - // btc_pk is the Bitcoin secp256k1 PK of this BTC delegation - // the PK follows encoding in BIP-340 spec - BtcPk *github_com_babylonlabs_io_babylon_types.BIP340PubKey `protobuf:"bytes,1,opt,name=btc_pk,json=btcPk,proto3,customtype=github.com/babylonlabs-io/babylon/types.BIP340PubKey" json:"btc_pk,omitempty"` - // staker_addr is the address to receive rewards from BTC delegation. - StakerAddr string `protobuf:"bytes,2,opt,name=staker_addr,json=stakerAddr,proto3" json:"staker_addr,omitempty"` - // staking_tx_hash is the staking tx hash of the BTC delegation - StakingTxHash string `protobuf:"bytes,3,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` - // total_sat is the amount of BTC stake (in Satoshi) of the BTC delegation - TotalSat uint64 `protobuf:"varint,4,opt,name=total_sat,json=totalSat,proto3" json:"total_sat,omitempty"` -} - -func (m *BTCDelDistInfo) Reset() { *m = BTCDelDistInfo{} } -func (m *BTCDelDistInfo) String() string { return proto.CompactTextString(m) } -func (*BTCDelDistInfo) ProtoMessage() {} -func (*BTCDelDistInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ca5b87e52e3e6d02, []int{2} -} -func (m *BTCDelDistInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BTCDelDistInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BTCDelDistInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BTCDelDistInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_BTCDelDistInfo.Merge(m, src) -} -func (m *BTCDelDistInfo) XXX_Size() int { - return m.Size() -} -func (m *BTCDelDistInfo) XXX_DiscardUnknown() { - xxx_messageInfo_BTCDelDistInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_BTCDelDistInfo proto.InternalMessageInfo - -func (m *BTCDelDistInfo) GetStakerAddr() string { - if m != nil { - return m.StakerAddr - } - return "" -} - -func (m *BTCDelDistInfo) GetStakingTxHash() string { - if m != nil { - return m.StakingTxHash - } - return "" -} - -func (m *BTCDelDistInfo) GetTotalSat() uint64 { - if m != nil { - return m.TotalSat - } - return 0 -} - // IndexedBlock is the necessary metadata and finalization status of a block type IndexedBlock struct { // height is the height of the block @@ -259,7 +183,7 @@ func (m *IndexedBlock) Reset() { *m = IndexedBlock{} } func (m *IndexedBlock) String() string { return proto.CompactTextString(m) } func (*IndexedBlock) ProtoMessage() {} func (*IndexedBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_ca5b87e52e3e6d02, []int{3} + return fileDescriptor_ca5b87e52e3e6d02, []int{2} } func (m *IndexedBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -328,7 +252,7 @@ func (m *PubRandCommit) Reset() { *m = PubRandCommit{} } func (m *PubRandCommit) String() string { return proto.CompactTextString(m) } func (*PubRandCommit) ProtoMessage() {} func (*PubRandCommit) Descriptor() ([]byte, []int) { - return fileDescriptor_ca5b87e52e3e6d02, []int{4} + return fileDescriptor_ca5b87e52e3e6d02, []int{3} } func (m *PubRandCommit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -412,7 +336,7 @@ func (m *Evidence) Reset() { *m = Evidence{} } func (m *Evidence) String() string { return proto.CompactTextString(m) } func (*Evidence) ProtoMessage() {} func (*Evidence) Descriptor() ([]byte, []int) { - return fileDescriptor_ca5b87e52e3e6d02, []int{5} + return fileDescriptor_ca5b87e52e3e6d02, []int{4} } func (m *Evidence) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -480,7 +404,7 @@ func (m *FinalityProviderSigningInfo) Reset() { *m = FinalityProviderSig func (m *FinalityProviderSigningInfo) String() string { return proto.CompactTextString(m) } func (*FinalityProviderSigningInfo) ProtoMessage() {} func (*FinalityProviderSigningInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ca5b87e52e3e6d02, []int{6} + return fileDescriptor_ca5b87e52e3e6d02, []int{5} } func (m *FinalityProviderSigningInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -533,7 +457,6 @@ func (m *FinalityProviderSigningInfo) GetJailedUntil() time.Time { func init() { proto.RegisterType((*VotingPowerDistCache)(nil), "babylon.finality.v1.VotingPowerDistCache") proto.RegisterType((*FinalityProviderDistInfo)(nil), "babylon.finality.v1.FinalityProviderDistInfo") - proto.RegisterType((*BTCDelDistInfo)(nil), "babylon.finality.v1.BTCDelDistInfo") proto.RegisterType((*IndexedBlock)(nil), "babylon.finality.v1.IndexedBlock") proto.RegisterType((*PubRandCommit)(nil), "babylon.finality.v1.PubRandCommit") proto.RegisterType((*Evidence)(nil), "babylon.finality.v1.Evidence") @@ -545,71 +468,65 @@ func init() { } var fileDescriptor_ca5b87e52e3e6d02 = []byte{ - // 1019 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x26, 0x4e, 0x6c, 0x8f, 0xed, 0xb4, 0x99, 0x86, 0x6a, 0x9b, 0x80, 0x9d, 0x9a, 0x3f, - 0x8a, 0x50, 0xb3, 0xa6, 0x69, 0x85, 0xa0, 0x07, 0xa4, 0x6c, 0xd2, 0xaa, 0x81, 0x40, 0xad, 0x75, - 0xca, 0x01, 0x21, 0x8d, 0x66, 0x77, 0xc7, 0xbb, 0x83, 0x77, 0x67, 0x56, 0x3b, 0xb3, 0x21, 0xe6, - 0x03, 0x20, 0x8e, 0xe5, 0x86, 0xc4, 0x85, 0x23, 0x47, 0x0e, 0xfd, 0x10, 0x3d, 0xa1, 0xaa, 0x27, - 0x94, 0x43, 0x80, 0xe4, 0xc0, 0xd7, 0x40, 0x3b, 0xb3, 0x5e, 0xc7, 0x55, 0x11, 0x08, 0xca, 0xc5, - 0x9a, 0xf9, 0xbd, 0x37, 0xef, 0xdf, 0xef, 0xbd, 0xb7, 0x06, 0x5d, 0x17, 0xbb, 0xe3, 0x88, 0xb3, - 0xde, 0x90, 0x32, 0x1c, 0x51, 0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- 0x06, 0x70, 0x08, 0x56, 0x54, 0x54, 0x33, 0xce, 0xaa, 0xff, 0xd9, 0xd9, 0xa5, 0xdc, 0xe8, 0x05, - 0x3f, 0xdd, 0xef, 0xe6, 0xc1, 0xfa, 0xf3, 0xfb, 0x77, 0x40, 0x03, 0x46, 0x59, 0xa0, 0xc6, 0xfd, - 0x7f, 0xeb, 0x8d, 0x99, 0x01, 0xc8, 0x7b, 0x63, 0x61, 0x76, 0x00, 0xb6, 0xc1, 0x2b, 0xf9, 0x4a, - 0x25, 0x3e, 0x52, 0x1d, 0x23, 0x90, 0xc7, 0x33, 0x26, 0x49, 0xaa, 0x1a, 0x65, 0xc1, 0xb9, 0xa2, - 0x85, 0x6a, 0x64, 0xc5, 0xae, 0x16, 0xc1, 0x03, 0xd0, 0xd4, 0x7b, 0x0e, 0x65, 0x4c, 0xd2, 0x48, - 0x51, 0xde, 0xd8, 0x5e, 0xb3, 0xf4, 0x57, 0xd5, 0x9a, 0x7c, 0x55, 0xad, 0x72, 0x3d, 0xda, 0xad, - 0x27, 0xa7, 0x9d, 0xb9, 0x47, 0xbf, 0x76, 0x8c, 0x1f, 0xff, 0xf8, 0xe9, 0x6d, 0xc3, 0x69, 0xe8, - 0xe7, 0x0f, 0xf3, 0xd7, 0xf6, 0xc1, 0x93, 0xb3, 0xb6, 0xf1, 0xf4, 0xac, 0x6d, 0xfc, 0x76, 0xd6, - 0x36, 0x1e, 0x9d, 0xb7, 0xe7, 0x9e, 0x9e, 0xb7, 0xe7, 0x7e, 0x39, 0x6f, 0xcf, 0x7d, 0xb6, 0xfd, - 0xf7, 0xd9, 0x1f, 0x4f, 0xff, 0x3f, 0xa8, 0x42, 0xb8, 0x4b, 0xca, 0xfb, 0xad, 0x3f, 0x03, 0x00, - 0x00, 0xff, 0xff, 0xe6, 0xb7, 0x70, 0x5d, 0x60, 0x08, 0x00, 0x00, + // 916 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x6f, 0xdc, 0x44, + 0x14, 0x5f, 0x27, 0x9b, 0xec, 0xee, 0xec, 0x6e, 0x68, 0xa6, 0xa1, 0x72, 0x13, 0xd8, 0xdd, 0xae, + 0x40, 0x5a, 0xa1, 0xc6, 0xa6, 0x69, 0x85, 0x50, 0x6f, 0x75, 0xd2, 0xaa, 0x81, 0x40, 0x57, 0xde, + 0x94, 0x03, 0x42, 0x1a, 0x8d, 0xed, 0xb1, 0x3d, 0xac, 0x3d, 0x63, 0x79, 0xc6, 0x4b, 0x97, 0x0f, + 0x80, 0x38, 0x96, 0x1b, 0x47, 0x8e, 0x1c, 0x39, 0xf0, 0x21, 0x7a, 0x42, 0x15, 0x27, 0x14, 0xa4, + 0x80, 0x92, 0x03, 0x5f, 0x03, 0x79, 0xec, 0xf5, 0x26, 0x11, 0x08, 0xc4, 0x9f, 0x8b, 0x35, 0xef, + 0xf7, 0x9e, 0xdf, 0x9f, 0xdf, 0x7b, 0xf3, 0x06, 0x0c, 0x1d, 0xec, 0xcc, 0x23, 0xce, 0x4c, 0x9f, + 0x32, 0x1c, 0x51, 0x39, 0x37, 0x67, 0x77, 0xaa, 0xb3, 0x91, 0xa4, 0x5c, 0x72, 0x78, 0xbd, 0xb4, + 0x31, 0x2a, 0x7c, 0x76, 0x67, 0xfb, 0xa6, 0xcb, 0x45, 0xcc, 0x05, 0x52, 0x26, 0x66, 0x21, 0x14, + 0xf6, 0xdb, 0x5b, 0x01, 0x0f, 0x78, 0x81, 0xe7, 0xa7, 0x12, 0xdd, 0xc4, 0x31, 0x65, 0xdc, 0x54, + 0xdf, 0x12, 0xea, 0x07, 0x9c, 0x07, 0x11, 0x31, 0x95, 0xe4, 0x64, 0xbe, 0x29, 0x69, 0x4c, 0x84, + 0xc4, 0x71, 0x52, 0x18, 0x0c, 0x7f, 0xd0, 0xc0, 0xd6, 0x47, 0x5c, 0x52, 0x16, 0x8c, 0xf9, 0x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 0xa9, 0x10, 0x94, 0x33, 0x95, 0x69, 0xcb, 0xda, 0x3d, 0x39, + 0xed, 0xef, 0x14, 0x2d, 0x14, 0xde, 0xd4, 0xa0, 0xdc, 0x8c, 0xb1, 0x0c, 0x8d, 0x23, 0x12, 0x60, + 0x77, 0x7e, 0x40, 0xdc, 0x1f, 0xbf, 0xdf, 0x05, 0x65, 0x87, 0x0f, 0x88, 0x6b, 0x5f, 0x70, 0x00, + 0x47, 0xa0, 0xa0, 0x1b, 0x39, 0x9c, 0x79, 0xc4, 0x43, 0x02, 0x4b, 0xbd, 0xae, 0xda, 0xb0, 0xa1, + 0x70, 0x4b, 0xc1, 0x13, 0x2c, 0xe1, 0x9b, 0x60, 0x83, 0x0a, 0x54, 0x75, 0x98, 0x78, 0xfa, 0xda, + 0x40, 0x1b, 0x35, 0xed, 0x2e, 0x15, 0xc7, 0x4b, 0x10, 0xee, 0x80, 0x16, 0x15, 0xe8, 0x53, 0x4c, + 0x23, 0xe2, 0xe9, 0xeb, 0xca, 0xa2, 0x49, 0xc5, 0x7b, 0x4a, 0x86, 0xaf, 0x03, 0x40, 0x05, 0x12, + 0x11, 0x16, 0x21, 0xf1, 0xf4, 0x86, 0xd2, 0xb6, 0xa8, 0x98, 0x14, 0xc0, 0x10, 0x81, 0xce, 0x21, + 0xf3, 0xc8, 0x33, 0xe2, 0x59, 0x11, 0x77, 0xa7, 0xf0, 0x06, 0x58, 0x0f, 0x09, 0x0d, 0x42, 0x59, + 0x4e, 0x46, 0x29, 0xc1, 0x9b, 0xa0, 0x89, 0x93, 0x04, 0x85, 0x58, 0x84, 0x25, 0x37, 0x0d, 0x9c, + 0x24, 0x8f, 0xb1, 0x08, 0xe1, 0x6b, 0xa0, 0x55, 0x74, 0xf8, 0x73, 0xe2, 0x29, 0x76, 0x9a, 0xf6, + 0x12, 0x18, 0x7e, 0xa5, 0x81, 0xee, 0x38, 0x73, 0x6c, 0xcc, 0xbc, 0xfd, 0x9c, 0x03, 0x09, 0x6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 0xe3, 0x13, 0x1a, 0x40, 0x1f, 0x6c, 0xaa, 0xac, 0x2e, 0x05, + 0x6b, 0xfc, 0xeb, 0x60, 0xaf, 0xe4, 0x4e, 0x2f, 0xc4, 0x19, 0x7e, 0xbd, 0x02, 0x76, 0xae, 0xee, + 0x96, 0x09, 0x0d, 0x18, 0x65, 0x81, 0x5a, 0x2f, 0xff, 0xdb, 0x6c, 0x5c, 0xba, 0x00, 0xf9, 0x6c, + 0xac, 0x5e, 0xbe, 0x00, 0x7b, 0xe0, 0xd5, 0x7c, 0x5d, 0x10, 0x0f, 0xa9, 0x89, 0x11, 0xc8, 0xe5, + 0x19, 0x93, 0x24, 0x55, 0x83, 0xb2, 0x6a, 0x5f, 0x2f, 0x94, 0xea, 0xca, 0x8a, 0xfd, 0x42, 0x05, + 0x8f, 0x40, 0xa7, 0xd8, 0x01, 0x28, 0x63, 0x92, 0x46, 0xaa, 0xe5, 0xed, 0xbd, 0x6d, 0xa3, 0x78, + 0x31, 0x8c, 0xc5, 0x8b, 0x61, 0x54, 0xab, 0xc3, 0xea, 0xbe, 0x38, 0xed, 0xd7, 0x9e, 0xff, 0xd2, + 0xd7, 0xbe, 0xfd, 0xed, 0xbb, 0xb7, 0x34, 0xbb, 0x5d, 0xfc, 0xfe, 0x34, 0xff, 0xdb, 0x3a, 0x7a, + 0x71, 0xd6, 0xd3, 0x5e, 0x9e, 0xf5, 0xb4, 0x5f, 0xcf, 0x7a, 0xda, 0xf3, 0xf3, 0x5e, 0xed, 0xe5, + 0x79, 0xaf, 0xf6, 0xd3, 0x79, 0xaf, 0xf6, 0xf1, 0xde, 0x5f, 0x57, 0xff, 0x6c, 0xf9, 0x36, 0x2a, + 0x22, 0x9c, 0x75, 0x15, 0xfd, 0xee, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0x04, 0xb9, 0x65, 0xd0, + 0x3c, 0x07, 0x00, 0x00, } func (m *VotingPowerDistCache) Marshal() (dAtA []byte, err error) { @@ -687,7 +604,7 @@ func (m *FinalityProviderDistInfo) MarshalToSizedBuffer(dAtA []byte) (int, error dAtA[i] = 0 } i-- - dAtA[i] = 0x40 + dAtA[i] = 0x38 } if m.IsJailed { i-- @@ -697,7 +614,7 @@ func (m *FinalityProviderDistInfo) MarshalToSizedBuffer(dAtA []byte) (int, error dAtA[i] = 0 } i-- - dAtA[i] = 0x38 + dAtA[i] = 0x30 } if m.IsTimestamped { i-- @@ -707,21 +624,7 @@ func (m *FinalityProviderDistInfo) MarshalToSizedBuffer(dAtA []byte) (int, error dAtA[i] = 0 } i-- - dAtA[i] = 0x30 - } - if len(m.BtcDels) > 0 { - for iNdEx := len(m.BtcDels) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.BtcDels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintFinality(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } + dAtA[i] = 0x28 } if m.TotalBondedSat != 0 { i = encodeVarintFinality(dAtA, i, uint64(m.TotalBondedSat)) @@ -762,60 +665,6 @@ func (m *FinalityProviderDistInfo) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *BTCDelDistInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BTCDelDistInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BTCDelDistInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TotalSat != 0 { - i = encodeVarintFinality(dAtA, i, uint64(m.TotalSat)) - i-- - dAtA[i] = 0x20 - } - if len(m.StakingTxHash) > 0 { - i -= len(m.StakingTxHash) - copy(dAtA[i:], m.StakingTxHash) - i = encodeVarintFinality(dAtA, i, uint64(len(m.StakingTxHash))) - i-- - dAtA[i] = 0x1a - } - if len(m.StakerAddr) > 0 { - i -= len(m.StakerAddr) - copy(dAtA[i:], m.StakerAddr) - i = encodeVarintFinality(dAtA, i, uint64(len(m.StakerAddr))) - i-- - dAtA[i] = 0x12 - } - if m.BtcPk != nil { - { - size := m.BtcPk.Size() - i -= size - if _, err := m.BtcPk.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintFinality(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *IndexedBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1102,12 +951,6 @@ func (m *FinalityProviderDistInfo) Size() (n int) { if m.TotalBondedSat != 0 { n += 1 + sovFinality(uint64(m.TotalBondedSat)) } - if len(m.BtcDels) > 0 { - for _, e := range m.BtcDels { - l = e.Size() - n += 1 + l + sovFinality(uint64(l)) - } - } if m.IsTimestamped { n += 2 } @@ -1120,30 +963,6 @@ func (m *FinalityProviderDistInfo) Size() (n int) { return n } -func (m *BTCDelDistInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BtcPk != nil { - l = m.BtcPk.Size() - n += 1 + l + sovFinality(uint64(l)) - } - l = len(m.StakerAddr) - if l > 0 { - n += 1 + l + sovFinality(uint64(l)) - } - l = len(m.StakingTxHash) - if l > 0 { - n += 1 + l + sovFinality(uint64(l)) - } - if m.TotalSat != 0 { - n += 1 + sovFinality(uint64(m.TotalSat)) - } - return n -} - func (m *IndexedBlock) Size() (n int) { if m == nil { return 0 @@ -1524,40 +1343,6 @@ func (m *FinalityProviderDistInfo) Unmarshal(dAtA []byte) error { } } case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BtcDels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFinality - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthFinality - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthFinality - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BtcDels = append(m.BtcDels, &BTCDelDistInfo{}) - if err := m.BtcDels[len(m.BtcDels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field IsTimestamped", wireType) } @@ -1577,7 +1362,7 @@ func (m *FinalityProviderDistInfo) Unmarshal(dAtA []byte) error { } } m.IsTimestamped = bool(v != 0) - case 7: + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field IsJailed", wireType) } @@ -1597,7 +1382,7 @@ func (m *FinalityProviderDistInfo) Unmarshal(dAtA []byte) error { } } m.IsJailed = bool(v != 0) - case 8: + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field IsSlashed", wireType) } @@ -1638,174 +1423,6 @@ func (m *FinalityProviderDistInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *BTCDelDistInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFinality - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BTCDelDistInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BTCDelDistInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BtcPk", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFinality - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthFinality - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthFinality - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_babylonlabs_io_babylon_types.BIP340PubKey - m.BtcPk = &v - if err := m.BtcPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakerAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFinality - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthFinality - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthFinality - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StakerAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakingTxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFinality - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthFinality - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthFinality - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StakingTxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalSat", wireType) - } - m.TotalSat = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFinality - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalSat |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipFinality(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthFinality - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *IndexedBlock) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/finality/types/power_table.go b/x/finality/types/power_table.go index 7dc357065..1d8a271f3 100644 --- a/x/finality/types/power_table.go +++ b/x/finality/types/power_table.go @@ -146,7 +146,6 @@ func NewFinalityProviderDistInfo(fp *bstypes.FinalityProvider) *FinalityProvider Addr: sdk.MustAccAddressFromBech32(fp.Addr), Commission: fp.Commission, TotalBondedSat: 0, - BtcDels: []*BTCDelDistInfo{}, } } @@ -155,33 +154,17 @@ func (v *FinalityProviderDistInfo) GetAddress() sdk.AccAddress { } func (v *FinalityProviderDistInfo) AddBTCDel(btcDel *bstypes.BTCDelegation) { - btcDelDistInfo := &BTCDelDistInfo{ - BtcPk: btcDel.BtcPk, - StakerAddr: btcDel.StakerAddr, - StakingTxHash: btcDel.MustGetStakingTxHash().String(), - TotalSat: btcDel.TotalSat, - } - v.BtcDels = append(v.BtcDels, btcDelDistInfo) - v.TotalBondedSat += btcDelDistInfo.TotalSat + v.TotalBondedSat += btcDel.TotalSat } func (v *FinalityProviderDistInfo) UnbondBTCDel(btcDel *bstypes.BTCDelegation) { - v.TotalBondedSat = v.TotalBondedSat - btcDel.TotalSat -} - -func (v *FinalityProviderDistInfo) AddBTCDelDistInfo(d *BTCDelDistInfo) { - v.BtcDels = append(v.BtcDels, d) - v.TotalBondedSat += d.TotalSat + v.TotalBondedSat -= btcDel.TotalSat } // GetBTCDelPortion returns the portion of a BTC delegation's voting power out of // the finality provider's total voting power -func (v *FinalityProviderDistInfo) GetBTCDelPortion(d *BTCDelDistInfo) sdkmath.LegacyDec { - return sdkmath.LegacyNewDec(int64(d.TotalSat)).QuoTruncate(sdkmath.LegacyNewDec(int64(v.TotalBondedSat))) -} - -func (d *BTCDelDistInfo) GetAddress() sdk.AccAddress { - return sdk.MustAccAddressFromBech32(d.StakerAddr) +func (v *FinalityProviderDistInfo) GetBTCDelPortion(totalSatDelegation uint64) sdkmath.LegacyDec { + return sdkmath.LegacyNewDec(int64(totalSatDelegation)).QuoTruncate(sdkmath.LegacyNewDec(int64(v.TotalBondedSat))) } // SortFinalityProvidersWithZeroedVotingPower sorts the finality providers slice, diff --git a/x/incentive/keeper/btc_staking_gauge_test.go b/x/incentive/keeper/btc_staking_gauge_test.go index 8939ed4d4..d3aa72494 100644 --- a/x/incentive/keeper/btc_staking_gauge_test.go +++ b/x/incentive/keeper/btc_staking_gauge_test.go @@ -34,7 +34,7 @@ func FuzzRewardBTCStaking(f *testing.F) { k.SetBTCStakingGauge(ctx, height, gauge) // generate a random voting power distribution cache - dc, err := datagen.GenRandomVotingPowerDistCache(r, 100) + dc, btcTotalSatByDelAddressByFpAddress, err := datagen.GenRandomVotingPowerDistCache(r, 100) require.NoError(t, err) // expected values @@ -56,14 +56,15 @@ func FuzzRewardBTCStaking(f *testing.F) { sumCoinsForDels = sumCoinsForDels.Add(coinsForBTCDels...) fpAddr := fp.GetAddress() - for _, btcDel := range fp.BtcDels { - err := k.BtcDelegationActivated(ctx, fpAddr, btcDel.GetAddress(), btcDel.TotalSat) + for delAddrStr, delSat := range btcTotalSatByDelAddressByFpAddress[fpAddr.String()] { + btcDelAddr := sdk.MustAccAddressFromBech32(delAddrStr) + err := k.BtcDelegationActivated(ctx, fpAddr, btcDelAddr, delSat) require.NoError(t, err) - btcDelPortion := fp.GetBTCDelPortion(btcDel) + btcDelPortion := fp.GetBTCDelPortion(delSat) coinsForDel := types.GetCoinsPortion(coinsForBTCDels, btcDelPortion) if coinsForDel.IsAllPositive() { - btcDelRewardMap[btcDel.GetAddress().String()] = coinsForDel + btcDelRewardMap[delAddrStr] = coinsForDel distributedCoins.Add(coinsForDel...) } } @@ -74,11 +75,11 @@ func FuzzRewardBTCStaking(f *testing.F) { for _, fp := range dc.FinalityProviders { fpAddr := fp.GetAddress() - for _, btcDel := range fp.BtcDels { - delAddr := btcDel.GetAddress() + for delAddrStr, delSat := range btcTotalSatByDelAddressByFpAddress[fpAddr.String()] { + delAddr := sdk.MustAccAddressFromBech32(delAddrStr) delRwd, err := k.GetBTCDelegationRewardsTracker(ctx, fpAddr, delAddr) require.NoError(t, err) - require.Equal(t, delRwd.TotalActiveSat.Uint64(), btcDel.TotalSat) + require.Equal(t, delRwd.TotalActiveSat.Uint64(), delSat) // makes sure the rewards added reach the delegation gauge err = k.BtcDelegationActivated(ctx, fpAddr, delAddr, 0)