Skip to content

Commit

Permalink
rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 committed Sep 13, 2024
1 parent 4e91ce8 commit 678fe9d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion x/btcstaking/keeper/finality_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (k Keeper) SlashFinalityProvider(ctx context.Context, fpBTCPK []byte) error
return nil
}

func (k Keeper) NotifyConsumersOfSlashedFinalityProvider(ctx context.Context, fpBTCPK *bbn.BIP340PubKey) error {
func (k Keeper) PropagateFPSlashingToConsumers(ctx context.Context, fpBTCPK *bbn.BIP340PubKey) error {
// Get all delegations for this finality provider
delegations, err := k.getFPBTCDelegations(ctx, fpBTCPK)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion x/finality/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (k Keeper) slashFinalityProvider(ctx context.Context, fpBtcPk *bbn.BIP340Pu
}

// Notify consumer chains about the slashed finality provider
if err := k.BTCStakingKeeper.NotifyConsumersOfSlashedFinalityProvider(ctx, fpBtcPk); err != nil {
if err := k.BTCStakingKeeper.PropagateFPSlashingToConsumers(ctx, fpBtcPk); err != nil {
panic(fmt.Errorf("failed to notify consumers of slashed finality provider: %w", err))
}

Expand Down
4 changes: 2 additions & 2 deletions x/finality/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func FuzzAddFinalitySig(f *testing.F) {
bsKeeper.EXPECT().GetFinalityProvider(gomock.Any(), gomock.Eq(fpBTCPKBytes)).Return(fp, nil).Times(1)
// mock slashing interface
bsKeeper.EXPECT().SlashFinalityProvider(gomock.Any(), gomock.Eq(fpBTCPKBytes)).Return(nil).Times(1)
bsKeeper.EXPECT().NotifyConsumersOfSlashedFinalityProvider(gomock.Any(), gomock.Eq(fpBTCPK)).Return(nil).Times(1)
bsKeeper.EXPECT().PropagateFPSlashingToConsumers(gomock.Any(), gomock.Eq(fpBTCPK)).Return(nil).Times(1)

// NOTE: even though this finality provider is slashed, the msg should be successful
// Otherwise the saved evidence will be rolled back
Expand Down Expand Up @@ -267,7 +267,7 @@ func TestVoteForConflictingHashShouldRetrieveEvidenceAndSlash(t *testing.T) {
gomock.Eq(fpBTCPKBytes)).Return(fp, nil).Times(1)
bsKeeper.EXPECT().SlashFinalityProvider(gomock.Any(),
gomock.Eq(fpBTCPKBytes)).Return(nil).Times(1)
bsKeeper.EXPECT().NotifyConsumersOfSlashedFinalityProvider(gomock.Any(),
bsKeeper.EXPECT().PropagateFPSlashingToConsumers(gomock.Any(),
gomock.Eq(fpBTCPK)).Return(nil).Times(1)
_, err = ms.AddFinalitySig(ctx, msg)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion x/finality/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type BTCStakingKeeper interface {
GetFinalityProvider(ctx context.Context, fpBTCPK []byte) (*bstypes.FinalityProvider, error)
HasFinalityProvider(ctx context.Context, fpBTCPK []byte) bool
SlashFinalityProvider(ctx context.Context, fpBTCPK []byte) error
NotifyConsumersOfSlashedFinalityProvider(ctx context.Context, fpBTCPK *bbn.BIP340PubKey) error
PropagateFPSlashingToConsumers(ctx context.Context, fpBTCPK *bbn.BIP340PubKey) error
GetVotingPower(ctx context.Context, fpBTCPK []byte, height uint64) uint64
GetVotingPowerTable(ctx context.Context, height uint64) map[string]uint64
GetBTCStakingActivatedHeight(ctx context.Context) (uint64, error)
Expand Down
12 changes: 6 additions & 6 deletions x/finality/types/mocked_keepers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 678fe9d

Please sign in to comment.