From 747ca8eb11a95501cfc4010d2c3c98dd8e15cc6c Mon Sep 17 00:00:00 2001 From: Cirrus Gai Date: Thu, 19 Sep 2024 12:29:41 +0800 Subject: [PATCH] feat(ADR-025): Enable jailing and unjailing (#80) Closes #64. TODOs: - [x] #65 - [x] #74 - [x] https://github.com/babylonlabs-io/finality-provider/pull/56 - [x] #81 We still need to update the docs, add CLI cmd, and e2e tests but can be done in separate PRs --- app/app.go | 1 - .../signetlaunch/btcstaking_params_test.go | 5 +- app/upgrades/signetlaunch/finality_params.go | 11 + .../signetlaunch/finality_params_test.go | 17 + app/upgrades/signetlaunch/upgrades.go | 36 +- app/upgrades/signetlaunch/upgrades_test.go | 29 +- app/upgrades/types.go | 2 +- proto/babylon/btcstaking/v1/btcstaking.proto | 8 +- proto/babylon/btcstaking/v1/events.proto | 18 +- proto/babylon/btcstaking/v1/incentive.proto | 3 + proto/babylon/btcstaking/v1/query.proto | 4 +- proto/babylon/finality/v1/events.proto | 13 +- proto/babylon/finality/v1/finality.proto | 5 + proto/babylon/finality/v1/params.proto | 6 +- proto/babylon/finality/v1/tx.proto | 22 +- proto/buf.lock | 4 +- .../configurer/chain/queries_btcstaking.go | 11 + ...software_upgrade_e2e_signet_launch_test.go | 12 +- testutil/datagen/finality.go | 7 +- x/btcstaking/keeper/finality_providers.go | 61 +- x/btcstaking/keeper/hooks.go | 16 +- x/btcstaking/keeper/power_dist_change.go | 38 +- x/btcstaking/keeper/power_dist_change_test.go | 240 ++++++- .../keeper/voting_power_table_test.go | 2 +- x/btcstaking/types/btcstaking.go | 28 +- x/btcstaking/types/btcstaking.pb.go | 193 +++--- x/btcstaking/types/errors.go | 6 +- x/btcstaking/types/events.go | 20 + x/btcstaking/types/events.pb.go | 586 +++++++++++++++++- x/btcstaking/types/incentive.go | 5 +- x/btcstaking/types/incentive.pb.go | 118 ++-- x/btcstaking/types/query.go | 2 +- x/btcstaking/types/query.pb.go | 253 ++++---- x/epoching/keeper/msg_server.go | 5 +- x/finality/keeper/liveness.go | 84 +-- x/finality/keeper/liveness_test.go | 36 +- x/finality/keeper/msg_server.go | 63 +- x/finality/keeper/msg_server_test.go | 75 ++- x/finality/types/errors.go | 1 + x/finality/types/events.go | 8 +- x/finality/types/events.pb.go | 242 +------- x/finality/types/expected_keepers.go | 2 +- x/finality/types/finality.pb.go | 136 ++-- x/finality/types/keys.go | 13 - x/finality/types/metrics.go | 23 +- x/finality/types/mocked_keepers.go | 24 +- x/finality/types/params.go | 3 + x/finality/types/params.pb.go | 110 +++- x/finality/types/signing_info.go | 11 + x/finality/types/tx.pb.go | 473 ++++++++++++-- 50 files changed, 2273 insertions(+), 818 deletions(-) create mode 100644 app/upgrades/signetlaunch/finality_params.go create mode 100644 app/upgrades/signetlaunch/finality_params_test.go diff --git a/app/app.go b/app/app.go index b34badff9..afa68737e 100644 --- a/app/app.go +++ b/app/app.go @@ -812,7 +812,6 @@ func (app *BabylonApp) setupUpgradeHandlers() { upgrade.CreateUpgradeHandler( app.ModuleManager, app.configurator, - app.BaseApp, app.AppKeepers, ), ) diff --git a/app/upgrades/signetlaunch/btcstaking_params_test.go b/app/upgrades/signetlaunch/btcstaking_params_test.go index a025ad8dd..1df82afe2 100644 --- a/app/upgrades/signetlaunch/btcstaking_params_test.go +++ b/app/upgrades/signetlaunch/btcstaking_params_test.go @@ -3,12 +3,13 @@ package signetlaunch_test import ( "testing" + "github.com/stretchr/testify/require" + "github.com/babylonlabs-io/babylon/app" v1 "github.com/babylonlabs-io/babylon/app/upgrades/signetlaunch" - "github.com/stretchr/testify/require" ) -func TestHardCodedParamsAreValid(t *testing.T) { +func TestHardCodedBtcStakingParamsAreValid(t *testing.T) { bbnApp := app.NewTmpBabylonApp() loadedParamas, err := v1.LoadBtcStakingParamsFromData(bbnApp.AppCodec()) require.NoError(t, err) diff --git a/app/upgrades/signetlaunch/finality_params.go b/app/upgrades/signetlaunch/finality_params.go new file mode 100644 index 000000000..08b75dcda --- /dev/null +++ b/app/upgrades/signetlaunch/finality_params.go @@ -0,0 +1,11 @@ +package signetlaunch + +// TODO Some default parameters. Consider how to switch those depending on network: +// mainnet, testnet, devnet etc. +const FinalityParamStr = `{ + "signed_blocks_window": 100, + "finality_sig_timeout": 3, + "min_signed_per_window": "0.1", + "min_pub_rand": 100, + "jail_duration": "86400s" +}` diff --git a/app/upgrades/signetlaunch/finality_params_test.go b/app/upgrades/signetlaunch/finality_params_test.go new file mode 100644 index 000000000..d6ba29a34 --- /dev/null +++ b/app/upgrades/signetlaunch/finality_params_test.go @@ -0,0 +1,17 @@ +package signetlaunch_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/babylonlabs-io/babylon/app" + v1 "github.com/babylonlabs-io/babylon/app/upgrades/signetlaunch" +) + +func TestHardCodedFinalityParamsAreValid(t *testing.T) { + bbnApp := app.NewTmpBabylonApp() + loadedParamas, err := v1.LoadFinalityParamsFromData(bbnApp.AppCodec()) + require.NoError(t, err) + require.NoError(t, loadedParamas.Validate()) +} diff --git a/app/upgrades/signetlaunch/upgrades.go b/app/upgrades/signetlaunch/upgrades.go index 16a60bc67..2e3726f9e 100644 --- a/app/upgrades/signetlaunch/upgrades.go +++ b/app/upgrades/signetlaunch/upgrades.go @@ -27,6 +27,8 @@ import ( btcstkkeeper "github.com/babylonlabs-io/babylon/x/btcstaking/keeper" btcstktypes "github.com/babylonlabs-io/babylon/x/btcstaking/types" bsctypes "github.com/babylonlabs-io/babylon/x/btcstkconsumer/types" + finalitykeeper "github.com/babylonlabs-io/babylon/x/finality/keeper" + finalitytypes "github.com/babylonlabs-io/babylon/x/finality/types" ) var Upgrade = upgrades.Upgrade{ @@ -47,7 +49,6 @@ type DataSignedFps struct { func CreateUpgradeHandler( mm *module.Manager, cfg module.Configurator, - app upgrades.BaseAppParamManager, keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(context context.Context, _plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { @@ -63,6 +64,10 @@ func CreateUpgradeHandler( panic(err) } + if err := upgradeFinalityParameters(ctx, keepers.EncCfg, &keepers.FinalityKeeper); err != nil { + panic(err) + } + if err := propLaunch(ctx, keepers.EncCfg, &keepers.BTCLightClientKeeper, &keepers.BTCStakingKeeper); err != nil { panic(err) } @@ -83,6 +88,18 @@ func LoadBtcStakingParamsFromData(cdc codec.Codec) (btcstktypes.Params, error) { return params, nil } +func LoadFinalityParamsFromData(cdc codec.Codec) (finalitytypes.Params, error) { + buff := bytes.NewBufferString(FinalityParamStr) + + var params finalitytypes.Params + err := cdc.UnmarshalJSON(buff.Bytes(), ¶ms) + if err != nil { + return finalitytypes.Params{}, err + } + + return params, nil +} + func upgradeBtcStakingParameters( ctx sdk.Context, e *appparams.EncodingConfig, @@ -102,6 +119,23 @@ func upgradeBtcStakingParameters( return k.OverwriteParamsAtVersion(ctx, 0, params) } +func upgradeFinalityParameters( + ctx sdk.Context, + e *appparams.EncodingConfig, + k *finalitykeeper.Keeper, +) error { + + cdc := e.Codec + + params, err := LoadFinalityParamsFromData(cdc) + + if err != nil { + return err + } + + return k.SetParams(ctx, params) +} + // propLaunch runs the proposal of launch that is meant to insert new BTC Headers. func propLaunch( ctx sdk.Context, diff --git a/app/upgrades/signetlaunch/upgrades_test.go b/app/upgrades/signetlaunch/upgrades_test.go index 6a5c68a68..11245bcc6 100644 --- a/app/upgrades/signetlaunch/upgrades_test.go +++ b/app/upgrades/signetlaunch/upgrades_test.go @@ -9,14 +9,15 @@ import ( "cosmossdk.io/core/header" "cosmossdk.io/x/upgrade" upgradetypes "cosmossdk.io/x/upgrade/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "github.com/babylonlabs-io/babylon/app" v1 "github.com/babylonlabs-io/babylon/app/upgrades/signetlaunch" "github.com/babylonlabs-io/babylon/x/btclightclient" btclighttypes "github.com/babylonlabs-io/babylon/x/btclightclient/types" "github.com/babylonlabs-io/babylon/x/btcstaking/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" ) const ( @@ -75,10 +76,14 @@ func (s *UpgradeTestSuite) TestUpgrade() { oldFPsLen = len(resp.FinalityProviders) // Before upgrade, the params should be different - paramsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.app.AppCodec()) + bsParamsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.app.AppCodec()) s.NoError(err) - moduleParams := s.app.BTCStakingKeeper.GetParams(s.ctx) - s.NotEqualValues(moduleParams, paramsFromUpgrade) + bsModuleParams := s.app.BTCStakingKeeper.GetParams(s.ctx) + s.NotEqualValues(bsModuleParams, bsParamsFromUpgrade) + fParamsFromUpgrade, err := v1.LoadFinalityParamsFromData(s.app.AppCodec()) + s.NoError(err) + fModuleParams := s.app.FinalityKeeper.GetParams(s.ctx) + s.NotEqualValues(fModuleParams, fParamsFromUpgrade) }, func() { // inject upgrade plan @@ -135,11 +140,15 @@ func (s *UpgradeTestSuite) TestUpgrade() { s.EqualValues(fpFromKeeper.Pop.String(), fpInserted.Pop.String()) } - // Afer upgrade, the params should be the same - paramsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.app.AppCodec()) + // After upgrade, the params should be the same + bsParamsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.app.AppCodec()) + s.NoError(err) + bsModuleParams := s.app.BTCStakingKeeper.GetParams(s.ctx) + s.EqualValues(bsModuleParams, bsParamsFromUpgrade) + fParamsFromUpgrade, err := v1.LoadFinalityParamsFromData(s.app.AppCodec()) s.NoError(err) - moduleParams := s.app.BTCStakingKeeper.GetParams(s.ctx) - s.EqualValues(moduleParams, paramsFromUpgrade) + fModuleParams := s.app.FinalityKeeper.GetParams(s.ctx) + s.EqualValues(fModuleParams, fParamsFromUpgrade) }, }, } diff --git a/app/upgrades/types.go b/app/upgrades/types.go index 15fa8ae05..4ec0962af 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -26,7 +26,7 @@ type Upgrade struct { UpgradeName string // CreateUpgradeHandler defines the function that creates an upgrade handler - CreateUpgradeHandler func(*module.Manager, module.Configurator, BaseAppParamManager, *keepers.AppKeepers) upgradetypes.UpgradeHandler + CreateUpgradeHandler func(*module.Manager, module.Configurator, *keepers.AppKeepers) upgradetypes.UpgradeHandler // Store upgrades, should be used for any new modules introduced, new modules deleted, or store names renamed. StoreUpgrades store.StoreUpgrades diff --git a/proto/babylon/btcstaking/v1/btcstaking.proto b/proto/babylon/btcstaking/v1/btcstaking.proto index bec7142a6..0d451f0fb 100644 --- a/proto/babylon/btcstaking/v1/btcstaking.proto +++ b/proto/babylon/btcstaking/v1/btcstaking.proto @@ -33,8 +33,8 @@ message FinalityProvider { // the finality provider is slashed. // if it's 0 then the finality provider is not slashed uint64 slashed_btc_height = 7; - // sluggish defines whether the finality provider is detected sluggish - bool sluggish = 8; + // jailed defines whether the finality provider is jailed + bool jailed = 8; // consumer_id is the ID of the consumer the finality provider is operating on. // If it's missing / empty, it's assumed the finality provider is operating in the Babylon chain. string consumer_id = 9; @@ -57,8 +57,8 @@ message FinalityProviderWithMeta { // the finality provider is slashed. // if it's 0 then the finality provider is not slashed uint64 slashed_btc_height = 5; - // sluggish defines whether the finality provider is detected sluggish - bool sluggish = 6; + // jailed defines whether the finality provider is detected jailed + bool jailed = 6; } // BTCDelegation defines a BTC delegation diff --git a/proto/babylon/btcstaking/v1/events.proto b/proto/babylon/btcstaking/v1/events.proto index a8d4fb3e4..848a81f23 100644 --- a/proto/babylon/btcstaking/v1/events.proto +++ b/proto/babylon/btcstaking/v1/events.proto @@ -40,11 +40,27 @@ message EventPowerDistUpdate { bytes pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; } + // EventJailedFinalityProvider defines an event that a finality provider + // is jailed after being detected sluggish + message EventJailedFinalityProvider { + bytes pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; + } + + // EventUnjailedFinalityProvider defines an event that a jailed finality provider + // is unjailed after the jailing period is passed + message EventUnjailedFinalityProvider { + bytes pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; + } + // ev is the event that affects voting power distribution oneof ev { // slashed_fp means a finality provider is slashed EventSlashedFinalityProvider slashed_fp = 1; + // jailed_fp means a finality provider is jailed + EventJailedFinalityProvider jailed_fp = 2; + // unjailed_fp means a jailed finality provider is unjailed + EventUnjailedFinalityProvider unjailed_fp = 3; // btc_del_state_update means a BTC delegation's state is updated - EventBTCDelegationStateUpdate btc_del_state_update = 2; + EventBTCDelegationStateUpdate btc_del_state_update = 4; } } 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/proto/babylon/btcstaking/v1/query.proto b/proto/babylon/btcstaking/v1/query.proto index 3f9aabe51..f2464f54b 100644 --- a/proto/babylon/btcstaking/v1/query.proto +++ b/proto/babylon/btcstaking/v1/query.proto @@ -349,6 +349,6 @@ message FinalityProviderResponse { uint64 height = 8; // voting_power is the voting power of this finality provider at the given height uint64 voting_power = 9; - // sluggish defines whether the finality provider is detected sluggish - bool sluggish = 10; + // jailed defines whether the finality provider is jailed + bool jailed = 10; } diff --git a/proto/babylon/finality/v1/events.proto b/proto/babylon/finality/v1/events.proto index 1c2fe0947..9eab6232a 100644 --- a/proto/babylon/finality/v1/events.proto +++ b/proto/babylon/finality/v1/events.proto @@ -12,16 +12,9 @@ message EventSlashedFinalityProvider { Evidence evidence = 1; } -// EventSluggishFinalityProviderDetected is the event emitted when a finality provider is -// detected as sluggish -message EventSluggishFinalityProviderDetected { - // public_key is the BTC public key of the finality provider - string public_key = 1; -} - -// EventSluggishFinalityProviderReverted is the event emitted when a sluggish finality -// provider is no longer considered sluggish -message EventSluggishFinalityProviderReverted { +// EventJailedFinalityProvider is the event emitted when a finality provider is +// jailed due to inactivity +message EventJailedFinalityProvider { // public_key is the BTC public key of the finality provider string public_key = 1; } diff --git a/proto/babylon/finality/v1/finality.proto b/proto/babylon/finality/v1/finality.proto index 1167e774a..87216e454 100644 --- a/proto/babylon/finality/v1/finality.proto +++ b/proto/babylon/finality/v1/finality.proto @@ -4,6 +4,8 @@ package babylon.finality.v1; option go_package = "github.com/babylonlabs-io/babylon/x/finality/types"; import "gogoproto/gogo.proto"; +import "amino/amino.proto"; +import "google/protobuf/timestamp.proto"; // IndexedBlock is the necessary metadata and finalization status of a block message IndexedBlock { @@ -64,4 +66,7 @@ message FinalityProviderSigningInfo { // missed_blocks_counter defines a counter to avoid unnecessary array reads. // Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. int64 missed_blocks_counter = 3; + // Timestamp until which the validator is jailed due to liveness downtime. + google.protobuf.Timestamp jailed_until = 4 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/proto/babylon/finality/v1/params.proto b/proto/babylon/finality/v1/params.proto index 875497283..711626486 100644 --- a/proto/babylon/finality/v1/params.proto +++ b/proto/babylon/finality/v1/params.proto @@ -4,6 +4,7 @@ package babylon.finality.v1; import "gogoproto/gogo.proto"; import "amino/amino.proto"; import "cosmos_proto/cosmos.proto"; +import "google/protobuf/duration.proto"; option go_package = "github.com/babylonlabs-io/babylon/x/finality/types"; @@ -16,7 +17,7 @@ message Params { // vote before being judged as missing their voting turn on the given block int64 finality_sig_timeout = 2; // min_signed_per_window defines the minimum number of blocks that a finality provider is required to sign - // within the sliding window to avoid being detected as sluggish + // within the sliding window to avoid being jailed bytes min_signed_per_window = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", @@ -26,4 +27,7 @@ message Params { // min_pub_rand is the minimum number of public randomness each // message should commit uint64 min_pub_rand = 4; + // jail_duration is the minimum period of time that a finality provider remains jailed + google.protobuf.Duration jail_duration = 5 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdduration) = true]; } diff --git a/proto/babylon/finality/v1/tx.proto b/proto/babylon/finality/v1/tx.proto index fd46f9f3a..90d6ee73b 100644 --- a/proto/babylon/finality/v1/tx.proto +++ b/proto/babylon/finality/v1/tx.proto @@ -20,6 +20,9 @@ service Msg { // TODO: msg for evidence of equivocation. this is not specified yet // UpdateParams updates the finality module parameters. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // UnjailFinalityProvider defines a method for unjailing a jailed + // finality provider, thus it can receive voting power + rpc UnjailFinalityProvider(MsgUnjailFinalityProvider) returns (MsgUnjailFinalityProviderResponse); } // MsgCommitPubRandList defines a message for committing a list of public randomness for EOTS @@ -36,7 +39,7 @@ message MsgCommitPubRandList { // commitment is the commitment of these public randomness // currently it's the root of the Merkle tree that includes these public randomness bytes commitment = 5; - // sig is the signature on (start_height || num_pub_rand || commitment) signed by + // sig is the signature on (start_height || num_pub_rand || commitment) signed by // SK corresponding to fp_btc_pk. This prevents others to commit public // randomness on behalf of fp_btc_pk // TODO: another option is to restrict signer to correspond to fp_btc_pk. This restricts @@ -73,13 +76,13 @@ message MsgAddFinalitySigResponse{} // MsgUpdateParams defines a message for updating finality module parameters. message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; - + // authority is the address of the governance account. // just FYI: cosmos.AddressString marks that this field should use type alias // for AddressString instead of string, but the functionality is not yet implemented // in cosmos-proto string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + // params defines the finality parameters to update. // // NOTE: All parameters must be supplied. @@ -87,3 +90,16 @@ message MsgUpdateParams { } // MsgUpdateParamsResponse is the response to the MsgUpdateParams message. message MsgUpdateParamsResponse {} + +// MsgUnjailFinalityProvider defines the Msg/UnjailFinalityProvider request type +message MsgUnjailFinalityProvider { + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; + + string signer = 1; + // fp_btc_pk is the BTC PK of the finality provider that commits the public randomness + bytes fp_btc_pk = 2 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; +} + +// MsgUnjailFinalityProviderResponse defines the Msg/UnjailFinalityProvider response type +message MsgUnjailFinalityProviderResponse {} diff --git a/proto/buf.lock b/proto/buf.lock index 86b2b4892..b7694ebc3 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -19,8 +19,8 @@ deps: - remote: buf.build owner: cosmos repository: ibc - commit: c159402ffeef4c21a7f9f0643817ae0d - digest: shake256:694e3f5a1d469798bb6cb3510f6f489e10d9309d1f2e8f7a369a776947602195f13ab65972d2d586a1134978b6a6fa28a43e5d7710ef5032ba0c7fbbe6038f08 + commit: 41fbc441e4d645119d275150719c5441 + digest: shake256:a61d3e152909abddc91dcc1aec8ac997007bebd48a7921bc243681c708e6c9068f6484aa7ed4e6ff60101d3422c98744a4a5294bbda6aacdba07f1dfa4291020 - remote: buf.build owner: cosmos repository: ics23 diff --git a/test/e2e/configurer/chain/queries_btcstaking.go b/test/e2e/configurer/chain/queries_btcstaking.go index 861ac6a69..6ed084972 100644 --- a/test/e2e/configurer/chain/queries_btcstaking.go +++ b/test/e2e/configurer/chain/queries_btcstaking.go @@ -23,6 +23,17 @@ func (n *NodeConfig) QueryBTCStakingParams() *bstypes.Params { return &resp.Params } +func (n *NodeConfig) QueryFinalityParams() *ftypes.Params { + bz, err := n.QueryGRPCGateway("/babylon/finality/v1/params", url.Values{}) + require.NoError(n.t, err) + + var resp ftypes.QueryParamsResponse + err = util.Cdc.UnmarshalJSON(bz, &resp) + require.NoError(n.t, err) + + return &resp.Params +} + func (n *NodeConfig) QueryFinalityProviders() []*bstypes.FinalityProviderResponse { bz, err := n.QueryGRPCGateway("/babylon/btcstaking/v1/finality_providers", url.Values{}) require.NoError(n.t, err) diff --git a/test/e2e/software_upgrade_e2e_signet_launch_test.go b/test/e2e/software_upgrade_e2e_signet_launch_test.go index c7d06d810..4323f3af9 100644 --- a/test/e2e/software_upgrade_e2e_signet_launch_test.go +++ b/test/e2e/software_upgrade_e2e_signet_launch_test.go @@ -105,9 +105,17 @@ func (s *SoftwareUpgradeSignetLaunchTestSuite) TestUpgradeSignetLaunch() { // as the one from the data stakingParams := n.QueryBTCStakingParams() - paramsFromData, err := v1.LoadBtcStakingParamsFromData(bbnApp.AppCodec()) + stakingParamsFromData, err := v1.LoadBtcStakingParamsFromData(bbnApp.AppCodec()) s.NoError(err) - s.EqualValues(paramsFromData, *stakingParams) + s.EqualValues(stakingParamsFromData, *stakingParams) + // check that finality params correctly deserialize and that they are the same + // as the one from the data + finalityParams := n.QueryFinalityParams() + + finalityParamsFromData, err := v1.LoadFinalityParamsFromData(bbnApp.AppCodec()) + s.NoError(err) + + s.EqualValues(finalityParamsFromData, *finalityParams) } diff --git a/testutil/datagen/finality.go b/testutil/datagen/finality.go index ad6a6f12e..90e1a9312 100644 --- a/testutil/datagen/finality.go +++ b/testutil/datagen/finality.go @@ -3,13 +3,14 @@ package datagen import ( "math/rand" - "github.com/babylonlabs-io/babylon/crypto/eots" - bbn "github.com/babylonlabs-io/babylon/types" - ftypes "github.com/babylonlabs-io/babylon/x/finality/types" "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcec/v2/schnorr" "github.com/cometbft/cometbft/crypto/merkle" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/babylonlabs-io/babylon/crypto/eots" + bbn "github.com/babylonlabs-io/babylon/types" + ftypes "github.com/babylonlabs-io/babylon/x/finality/types" ) type RandListInfo struct { diff --git a/x/btcstaking/keeper/finality_providers.go b/x/btcstaking/keeper/finality_providers.go index d4848598a..1ceeafed4 100644 --- a/x/btcstaking/keeper/finality_providers.go +++ b/x/btcstaking/keeper/finality_providers.go @@ -202,24 +202,69 @@ func (k Keeper) collectSlashedConsumerEvents(ctx context.Context, delegations [] return consumerEvents, nil } -// RevertSluggishFinalityProvider sets the Sluggish flag of the given finality provider -// to false -func (k Keeper) RevertSluggishFinalityProvider(ctx context.Context, fpBTCPK []byte) error { +// JailFinalityProvider jails a finality provider with the given PK +// A jailed finality provider will not have voting power until it is +// unjailed (assuming it still ranks top N and has timestamped pub rand) +func (k Keeper) JailFinalityProvider(ctx context.Context, fpBTCPK []byte) error { // ensure finality provider exists fp, err := k.GetFinalityProvider(ctx, fpBTCPK) if err != nil { return err } - // ignore the finality provider is already slashed - // or detected as sluggish - if fp.IsSlashed() || fp.IsSluggish() { - return nil + // ensure finality provider is not slashed yet + if fp.IsSlashed() { + return types.ErrFpAlreadySlashed + } + + // ensure finality provider is not jailed yet + if fp.IsJailed() { + return types.ErrFpAlreadyJailed + } + + // set finality provider to be jailed + fp.Jailed = true + k.setFinalityProvider(ctx, fp) + + btcTip := k.btclcKeeper.GetTipInfo(ctx) + if btcTip == nil { + return fmt.Errorf("failed to get current BTC tip") + } + + // record jailed event. The next `BeginBlock` will consume this + // event for updating the finality provider set + powerUpdateEvent := types.NewEventPowerDistUpdateWithJailedFP(fp.BtcPk) + k.addPowerDistUpdateEvent(ctx, btcTip.Height, powerUpdateEvent) + + return nil +} + +// UnjailFinalityProvider reverts the Jailed flag of a finality provider +func (k Keeper) UnjailFinalityProvider(ctx context.Context, fpBTCPK []byte) error { + // ensure finality provider exists + fp, err := k.GetFinalityProvider(ctx, fpBTCPK) + if err != nil { + return err + } + + // ensure finality provider is already jailed + if !fp.IsJailed() { + return types.ErrFpNotJailed } - fp.Sluggish = false + fp.Jailed = false k.setFinalityProvider(ctx, fp) + btcTip := k.btclcKeeper.GetTipInfo(ctx) + if btcTip == nil { + return fmt.Errorf("failed to get current BTC tip") + } + + // record unjailed event. The next `BeginBlock` will consume this + // event for updating the finality provider set + powerUpdateEvent := types.NewEventPowerDistUpdateWithUnjailedFP(fp.BtcPk) + k.addPowerDistUpdateEvent(ctx, btcTip.Height, powerUpdateEvent) + return nil } diff --git a/x/btcstaking/keeper/hooks.go b/x/btcstaking/keeper/hooks.go index d17f71f5c..b4d93cefe 100644 --- a/x/btcstaking/keeper/hooks.go +++ b/x/btcstaking/keeper/hooks.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "fmt" bbntypes "github.com/babylonlabs-io/babylon/types" "github.com/babylonlabs-io/babylon/x/finality/types" @@ -22,18 +21,5 @@ func (k Keeper) Hooks() Hooks { // AfterSluggishFinalityProviderDetected updates the status of the given finality provider to `sluggish` func (h Hooks) AfterSluggishFinalityProviderDetected(ctx context.Context, fpPk *bbntypes.BIP340PubKey) error { - fp, err := h.k.GetFinalityProvider(ctx, fpPk.MustMarshal()) - if err != nil { - return err - } - - if fp.IsSluggish() { - return fmt.Errorf("the finality provider %s is already detected as sluggish", fpPk.MarshalHex()) - } - - fp.Sluggish = true - - h.k.setFinalityProvider(ctx, fp) - - return nil + return h.k.JailFinalityProvider(ctx, fpPk.MustMarshal()) } diff --git a/x/btcstaking/keeper/power_dist_change.go b/x/btcstaking/keeper/power_dist_change.go index f2e24b475..51455c812 100644 --- a/x/btcstaking/keeper/power_dist_change.go +++ b/x/btcstaking/keeper/power_dist_change.go @@ -69,7 +69,7 @@ func (k Keeper) UpdatePowerDist(ctx context.Context) { // reconcile old voting power distribution cache and new events // to construct the new distribution - newDc := k.ProcessAllPowerDistUpdateEvents(ctx, dc, events, maxActiveFps) + newDc := k.ProcessAllPowerDistUpdateEvents(ctx, dc, events) // record voting power and cache for this height k.recordVotingPowerAndCache(ctx, dc, newDc, maxActiveFps) @@ -91,11 +91,11 @@ 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) } // apply the finality provider voting power dist info to the new cache @@ -150,7 +150,6 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( ctx context.Context, dc *types.VotingPowerDistCache, events []*types.EventPowerDistUpdate, - maxActiveFps uint32, ) *types.VotingPowerDistCache { // 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 @@ -159,9 +158,13 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( unbondedBTCDels := map[string]struct{}{} // a map where key is slashed finality providers' BTC PK slashedFPs := map[string]struct{}{} + // a map where key is jailed finality providers' BTC PK + jailedFPs := map[string]struct{}{} + // a map where key is unjailed finality providers' BTC PK + unjailedFPs := map[string]struct{}{} /* - filter and classify all events into new/expired BTC delegations and slashed FPs + filter and classify all events into new/expired BTC delegations and jailed/slashed FPs */ for _, event := range events { switch typedEvent := event.Ev.(type) { @@ -186,8 +189,14 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( unbondedBTCDels[delEvent.StakingTxHash] = struct{}{} } case *types.EventPowerDistUpdate_SlashedFp: - // slashed finality providers + // record slashed fps slashedFPs[typedEvent.SlashedFp.Pk.MarshalHex()] = struct{}{} + case *types.EventPowerDistUpdate_JailedFp: + // record jailed fps + jailedFPs[typedEvent.JailedFp.Pk.MarshalHex()] = struct{}{} + case *types.EventPowerDistUpdate_UnjailedFp: + // record unjailed fps + unjailedFPs[typedEvent.UnjailedFp.Pk.MarshalHex()] = struct{}{} } } @@ -211,11 +220,24 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( fpBTCPKHex := fp.BtcPk.MarshalHex() - // if this finality provider is slashed, continue to avoid recording it + // if this finality provider is slashed, continue to avoid + // assigning delegation to it if _, ok := slashedFPs[fpBTCPKHex]; ok { continue } + // set IsJailed to be true if the fp is jailed + // Note that jailed fp can still accept delegations + // but won't be assigned with voting power + if _, ok := jailedFPs[fpBTCPKHex]; ok { + fp.IsJailed = true + } + + // set IsJailed to be false if the fp is unjailed + if _, ok := unjailedFPs[fpBTCPKHex]; ok { + 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] diff --git a/x/btcstaking/keeper/power_dist_change_test.go b/x/btcstaking/keeper/power_dist_change_test.go index 18110eb0c..4e323aad7 100644 --- a/x/btcstaking/keeper/power_dist_change_test.go +++ b/x/btcstaking/keeper/power_dist_change_test.go @@ -59,15 +59,15 @@ func FuzzProcessAllPowerDistUpdateEvents_Determinism(f *testing.F) { } } - newDc := h.BTCStakingKeeper.ProcessAllPowerDistUpdateEvents(h.Ctx, dc, events, 100) + newDc := h.BTCStakingKeeper.ProcessAllPowerDistUpdateEvents(h.Ctx, dc, events) for i := 0; i < 10; i++ { - newDc2 := h.BTCStakingKeeper.ProcessAllPowerDistUpdateEvents(h.Ctx, dc, events, 100) + newDc2 := h.BTCStakingKeeper.ProcessAllPowerDistUpdateEvents(h.Ctx, dc, events) require.Equal(t, newDc, newDc2) } }) } -func FuzzFinalityProviderEvents(f *testing.F) { +func FuzzSlashFinalityProviderEvent(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { @@ -128,6 +128,12 @@ func FuzzFinalityProviderEvents(f *testing.F) { err = h.BTCStakingKeeper.SlashFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) h.NoError(err) + err = h.BTCStakingKeeper.SlashFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + require.ErrorIs(t, err, types.ErrFpAlreadySlashed) + + err = h.BTCStakingKeeper.JailFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + require.ErrorIs(t, err, types.ErrFpAlreadySlashed) + // at this point, there should be only 1 event that the finality provider is slashed btcTipHeight := btclcKeeper.GetTipInfo(h.Ctx).Height h.BTCStakingKeeper.IteratePowerDistUpdateEvents(h.Ctx, btcTipHeight, func(ev *types.EventPowerDistUpdate) bool { @@ -148,6 +154,234 @@ func FuzzFinalityProviderEvents(f *testing.F) { }) } +func FuzzJailFinalityProviderEvents(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 10) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + // mock BTC light client and BTC checkpoint modules + btclcKeeper := types.NewMockBTCLightClientKeeper(ctrl) + btccKeeper := types.NewMockBtcCheckpointKeeper(ctrl) + finalityKeeper := types.NewMockFinalityKeeper(ctrl) + finalityKeeper.EXPECT().HasTimestampedPubRand(gomock.Any(), gomock.Any(), gomock.Any()).Return(true).AnyTimes() + h := NewHelper(t, btclcKeeper, btccKeeper, finalityKeeper) + + // set all parameters + covenantSKs, _ := h.GenAndApplyParams(r) + changeAddress, err := datagen.GenRandomBTCAddress(r, h.Net) + require.NoError(t, err) + + // generate and insert new finality provider + _, fpPK, fp := h.CreateFinalityProvider(r) + + /* + insert new BTC delegation and give it covenant quorum + ensure that it 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 := datagen.RandomInt(r, 10) + 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 + + fpBeforeJailing, err := h.BTCStakingKeeper.GetFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + h.NoError(err) + require.False(t, fpBeforeJailing.IsJailed()) + require.Equal(t, uint64(stakingValue), h.BTCStakingKeeper.GetVotingPower(h.Ctx, *fp.BtcPk, babylonHeight)) + + /* + Jail the finality provider and execute BeginBlock + Then, ensure the finality provider does not have voting power anymore + */ + err = h.BTCStakingKeeper.JailFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + h.NoError(err) + + err = h.BTCStakingKeeper.JailFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + require.ErrorIs(t, err, types.ErrFpAlreadyJailed) + + // ensure the jailed label is set + fpAfterJailing, err := h.BTCStakingKeeper.GetFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + h.NoError(err) + 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 + h.BTCStakingKeeper.IteratePowerDistUpdateEvents(h.Ctx, btcTipHeight, func(ev *types.EventPowerDistUpdate) bool { + jailedFPEvent := ev.GetJailedFp() + require.NotNil(t, jailedFPEvent) + require.Equal(t, fp.BtcPk.MustMarshal(), jailedFPEvent.Pk.MustMarshal()) + return true + }) + + // execute BeginBlock + 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 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)) + }) +} + +func FuzzUnjailFinalityProviderEvents(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 10) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + // mock BTC light client and BTC checkpoint modules + btclcKeeper := types.NewMockBTCLightClientKeeper(ctrl) + btccKeeper := types.NewMockBtcCheckpointKeeper(ctrl) + finalityKeeper := types.NewMockFinalityKeeper(ctrl) + finalityKeeper.EXPECT().HasTimestampedPubRand(gomock.Any(), gomock.Any(), gomock.Any()).Return(true).AnyTimes() + h := NewHelper(t, btclcKeeper, btccKeeper, finalityKeeper) + + // set all parameters + covenantSKs, _ := h.GenAndApplyParams(r) + changeAddress, err := datagen.GenRandomBTCAddress(r, h.Net) + require.NoError(t, err) + + // generate and insert new finality provider + _, fpPK, fp := h.CreateFinalityProvider(r) + + /* + insert new BTC delegation and give it covenant quorum + ensure that it 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 := datagen.RandomInt(r, 10) + 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 + fpBeforeJailing, err := h.BTCStakingKeeper.GetFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + h.NoError(err) + require.False(t, fpBeforeJailing.IsJailed()) + require.Equal(t, uint64(stakingValue), h.BTCStakingKeeper.GetVotingPower(h.Ctx, *fp.BtcPk, babylonHeight)) + + // try unjail fp that is not jailed, should expect error + err = h.BTCStakingKeeper.UnjailFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + require.ErrorIs(t, err, types.ErrFpNotJailed) + + /* + Jail the finality provider and execute BeginBlock + Then, ensure the finality provider does not have voting power anymore + */ + err = h.BTCStakingKeeper.JailFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + h.NoError(err) + + // ensure the jailed label is set + fpAfterJailing, err := h.BTCStakingKeeper.GetFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + h.NoError(err) + require.True(t, fpAfterJailing.IsJailed()) + + // execute BeginBlock + 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 does not have voting power anymore + require.Zero(t, h.BTCStakingKeeper.GetVotingPower(h.Ctx, *fp.BtcPk, babylonHeight)) + + /* + Unjail the finality provider and execute BeginBlock + Ensure that the finality provider regains voting power + */ + err = h.BTCStakingKeeper.UnjailFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + h.NoError(err) + + // ensure the jailed label is reverted + fpAfterUnjailing, err := h.BTCStakingKeeper.GetFinalityProvider(h.Ctx, fp.BtcPk.MustMarshal()) + h.NoError(err) + require.False(t, fpAfterUnjailing.IsJailed()) + + // execute BeginBlock + 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 does not have voting power anymore + require.Equal(t, uint64(stakingValue), h.BTCStakingKeeper.GetVotingPower(h.Ctx, *fp.BtcPk, babylonHeight)) + }) +} + func FuzzBTCDelegationEvents(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) diff --git a/x/btcstaking/keeper/voting_power_table_test.go b/x/btcstaking/keeper/voting_power_table_test.go index a4f12e7f8..14ef309c1 100644 --- a/x/btcstaking/keeper/voting_power_table_test.go +++ b/x/btcstaking/keeper/voting_power_table_test.go @@ -212,7 +212,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.SortFinalityProvidersWithZeroedVotingPower(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 b7338a84f..2914205c3 100644 --- a/x/btcstaking/types/btcstaking.go +++ b/x/btcstaking/types/btcstaking.go @@ -17,8 +17,8 @@ func (fp *FinalityProvider) IsSlashed() bool { return fp.SlashedBabylonHeight > 0 } -func (fp *FinalityProvider) IsSluggish() bool { - return fp.Sluggish +func (fp *FinalityProvider) IsJailed() bool { + return fp.Jailed } func (fp *FinalityProvider) ValidateBasic() error { @@ -42,18 +42,24 @@ func (fp *FinalityProvider) ValidateBasic() error { return nil } -// SortFinalityProvidersWithTimestamping 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) { +// SortFinalityProvidersWithZeroedVotingPower sorts the finality providers slice, +// from higher to lower voting power. In the following cases, the voting power +// is treated as zero: +// 1. IsTimestamped is false +// 2. IsJailed is true +func SortFinalityProvidersWithZeroedVotingPower(fps []*FinalityProviderDistInfo) { sort.SliceStable(fps, func(i, j int) bool { - if fps[i].IsTimestamped && !fps[j].IsTimestamped { - return true - } - if !fps[i].IsTimestamped && fps[j].IsTimestamped { + iShouldBeZeroed := fps[i].IsJailed || !fps[i].IsTimestamped + jShouldBeZeroed := fps[j].IsJailed || !fps[j].IsTimestamped + + if iShouldBeZeroed && !jShouldBeZeroed { return false } + + if !iShouldBeZeroed && jShouldBeZeroed { + return true + } + return fps[i].TotalVotingPower > fps[j].TotalVotingPower }) } diff --git a/x/btcstaking/types/btcstaking.pb.go b/x/btcstaking/types/btcstaking.pb.go index ffbded1f5..cece63543 100644 --- a/x/btcstaking/types/btcstaking.pb.go +++ b/x/btcstaking/types/btcstaking.pb.go @@ -90,8 +90,8 @@ type FinalityProvider struct { // the finality provider is slashed. // if it's 0 then the finality provider is not slashed SlashedBtcHeight uint64 `protobuf:"varint,7,opt,name=slashed_btc_height,json=slashedBtcHeight,proto3" json:"slashed_btc_height,omitempty"` - // sluggish defines whether the finality provider is detected sluggish - Sluggish bool `protobuf:"varint,8,opt,name=sluggish,proto3" json:"sluggish,omitempty"` + // jailed defines whether the finality provider is jailed + Jailed bool `protobuf:"varint,8,opt,name=jailed,proto3" json:"jailed,omitempty"` // consumer_id is the ID of the consumer the finality provider is operating on. // If it's missing / empty, it's assumed the finality provider is operating in the Babylon chain. ConsumerId string `protobuf:"bytes,9,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` @@ -165,9 +165,9 @@ func (m *FinalityProvider) GetSlashedBtcHeight() uint64 { return 0 } -func (m *FinalityProvider) GetSluggish() bool { +func (m *FinalityProvider) GetJailed() bool { if m != nil { - return m.Sluggish + return m.Jailed } return false } @@ -196,8 +196,8 @@ type FinalityProviderWithMeta struct { // the finality provider is slashed. // if it's 0 then the finality provider is not slashed SlashedBtcHeight uint64 `protobuf:"varint,5,opt,name=slashed_btc_height,json=slashedBtcHeight,proto3" json:"slashed_btc_height,omitempty"` - // sluggish defines whether the finality provider is detected sluggish - Sluggish bool `protobuf:"varint,6,opt,name=sluggish,proto3" json:"sluggish,omitempty"` + // jailed defines whether the finality provider is detected jailed + Jailed bool `protobuf:"varint,6,opt,name=jailed,proto3" json:"jailed,omitempty"` } func (m *FinalityProviderWithMeta) Reset() { *m = FinalityProviderWithMeta{} } @@ -261,9 +261,9 @@ func (m *FinalityProviderWithMeta) GetSlashedBtcHeight() uint64 { return 0 } -func (m *FinalityProviderWithMeta) GetSluggish() bool { +func (m *FinalityProviderWithMeta) GetJailed() bool { if m != nil { - return m.Sluggish + return m.Jailed } return false } @@ -772,85 +772,84 @@ func init() { } var fileDescriptor_3851ae95ccfaf7db = []byte{ - // 1233 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 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xa1, 0x1d, - 0xb8, 0x12, 0x10, 0xc9, 0xcd, 0x80, 0x38, 0x56, 0x14, 0x9f, 0xf7, 0xc2, 0x75, 0x61, 0x16, 0x62, - 0xd5, 0x43, 0x69, 0xde, 0xec, 0x7d, 0xb2, 0x0f, 0x57, 0x66, 0xe8, 0xd6, 0x14, 0x58, 0x0c, 0x39, - 0xd2, 0x61, 0xa1, 0xb1, 0x5f, 0xaf, 0xd6, 0xea, 0x5f, 0x15, 0xe6, 0x10, 0x40, 0x76, 0x77, 0xaf, - 0x55, 0x7b, 0xba, 0x5f, 0xd0, 0x50, 0x0e, 0x16, 0x0f, 0xeb, 0x95, 0x83, 0x7a, 0x75, 0xbf, 0x5a, - 0x48, 0xa1, 0x05, 0x48, 0xef, 0xd6, 0xbf, 0x2b, 0xa4, 0x2b, 0xf5, 0xe7, 0xaf, 0x36, 0xb4, 0x17, - 0xaf, 0x36, 0xb4, 0xbf, 0x5f, 0x6d, 0x68, 0xbf, 0xbd, 0xde, 0x98, 0x7b, 0xf1, 0x7a, 0x63, 0xee, - 0xaf, 0xd7, 0x1b, 0x73, 0xdf, 0x9f, 0xa1, 0x9c, 0x71, 0xf2, 0x9b, 0x40, 0xd5, 0xd6, 0xce, 0xaa, - 0x6f, 0x82, 0x7b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xa8, 0xf5, 0x28, 0x60, 0xcc, 0x0c, 0x00, - 0x00, + // 1232 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xdd, 0x6e, 0x1b, 0xc5, + 0x17, 0xcf, 0xda, 0x8e, 0x93, 0x9c, 0xb5, 0x1b, 0x77, 0x9a, 0xa6, 0xdb, 0x46, 0xff, 0x24, 0x7f, + 0x53, 0xaa, 0x08, 0x1a, 0xbb, 0x5f, 0x12, 0x45, 0x88, 0x8b, 0x38, 0x4e, 0xa9, 0x45, 0xeb, 0x98, +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, 0x57, 0x6d, 0xc9, 0xc7, 0xd2, + 0x16, 0x1d, 0x10, 0xf4, 0x15, 0x14, 0x24, 0x37, 0x86, 0x9e, 0x13, 0xb3, 0xdf, 0xb8, 0xa0, 0xa8, + 0x76, 0xe3, 0x84, 0x04, 0x2a, 0xad, 0xdd, 0x83, 0x84, 0xb5, 0xb9, 0xdc, 0x16, 0x76, 0x52, 0x20, + 0x91, 0x7d, 0x1c, 0xe0, 0x01, 0xb7, 0x46, 0x24, 0x50, 0x3b, 0x7f, 0x39, 0x44, 0x0e, 0xa5, 0x4f, + 0x42, 0x61, 0xf1, 0xb7, 0x0c, 0x2c, 0xbf, 0x16, 0x4b, 0xb2, 0x29, 0x91, 0xf4, 0x38, 0xdc, 0x4b, + 0xa6, 0x3e, 0x4d, 0xf9, 0x5f, 0x43, 0x4c, 0x9d, 0x66, 0x88, 0x1c, 0xae, 0x4c, 0x87, 0x38, 0x05, + 0x90, 0xe3, 0x4c, 0x9f, 0x7d, 0x9c, 0x97, 0xe3, 0xd8, 0x07, 0x93, 0xd0, 0x72, 0xae, 0x3f, 0xc2, + 0x6a, 0x82, 0x39, 0x93, 0x94, 0x25, 0x66, 0xe6, 0xec, 0x98, 0x2b, 0x53, 0x0a, 0x45, 0x91, 0x25, + 0x64, 0x07, 0x56, 0xa7, 0x54, 0x4a, 0x20, 0x72, 0x63, 0xfe, 0x3d, 0x39, 0xb5, 0x12, 0x73, 0x6a, + 0x0a, 0xc3, 0x91, 0x0d, 0x6b, 0x31, 0xce, 0x4c, 0x3b, 0xc3, 0x05, 0x93, 0x55, 0x60, 0xd7, 0x4f, + 0x00, 0x8b, 0xa3, 0xd7, 0xbc, 0x0e, 0x33, 0x8d, 0x49, 0xa0, 0x64, 0xef, 0xe4, 0x66, 0x29, 0x36, + 0xe1, 0xca, 0x74, 0x29, 0xb3, 0x60, 0xba, 0x9d, 0x39, 0xba, 0x0f, 0x19, 0x87, 0xf4, 0xb9, 0xa1, + 0xbd, 0x15, 0x68,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a2, 0x30, 0x87, 0x00, 0xb2, 0x3b, 0xbb, 0xad, + 0xda, 0x93, 0xbd, 0x82, 0x86, 0x72, 0xb0, 0x78, 0x50, 0xaf, 0xec, 0xd7, 0xab, 0x7b, 0xd5, 0x42, + 0x0a, 0x2d, 0x40, 0x7a, 0xa7, 0xfe, 0x4d, 0x21, 0x5d, 0xa9, 0x3f, 0x7b, 0xb9, 0xae, 0x3d, 0x7f, + 0xb9, 0xae, 0xfd, 0xf5, 0x72, 0x5d, 0xfb, 0xf5, 0xd5, 0xfa, 0xdc, 0xf3, 0x57, 0xeb, 0x73, 0x7f, + 0xbe, 0x5a, 0x9f, 0xfb, 0xf6, 0x14, 0xe5, 0x8c, 0x93, 0xdf, 0x02, 0xaa, 0xb6, 0x76, 0x56, 0x7d, + 0x0b, 0xdc, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x70, 0xf4, 0xf1, 0xc4, 0x0c, 0x00, 0x00, } func (m *FinalityProvider) Marshal() (dAtA []byte, err error) { @@ -880,9 +879,9 @@ func (m *FinalityProvider) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x4a } - if m.Sluggish { + if m.Jailed { i-- - if m.Sluggish { + if m.Jailed { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -978,9 +977,9 @@ func (m *FinalityProviderWithMeta) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.Sluggish { + if m.Jailed { i-- - if m.Sluggish { + if m.Jailed { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -1524,7 +1523,7 @@ func (m *FinalityProvider) Size() (n int) { if m.SlashedBtcHeight != 0 { n += 1 + sovBtcstaking(uint64(m.SlashedBtcHeight)) } - if m.Sluggish { + if m.Jailed { n += 2 } l = len(m.ConsumerId) @@ -1556,7 +1555,7 @@ func (m *FinalityProviderWithMeta) Size() (n int) { if m.SlashedBtcHeight != 0 { n += 1 + sovBtcstaking(uint64(m.SlashedBtcHeight)) } - if m.Sluggish { + if m.Jailed { n += 2 } return n @@ -2003,7 +2002,7 @@ func (m *FinalityProvider) Unmarshal(dAtA []byte) error { } case 8: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sluggish", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -2020,7 +2019,7 @@ func (m *FinalityProvider) Unmarshal(dAtA []byte) error { break } } - m.Sluggish = bool(v != 0) + m.Jailed = bool(v != 0) case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) @@ -2216,7 +2215,7 @@ func (m *FinalityProviderWithMeta) Unmarshal(dAtA []byte) error { } case 6: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sluggish", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -2233,7 +2232,7 @@ func (m *FinalityProviderWithMeta) Unmarshal(dAtA []byte) error { break } } - m.Sluggish = bool(v != 0) + m.Jailed = bool(v != 0) default: iNdEx = preIndex skippy, err := skipBtcstaking(dAtA[iNdEx:]) diff --git a/x/btcstaking/types/errors.go b/x/btcstaking/types/errors.go index bf6d52f5b..927009d3c 100644 --- a/x/btcstaking/types/errors.go +++ b/x/btcstaking/types/errors.go @@ -30,6 +30,8 @@ var ( ErrVotingPowerTableNotUpdated = errorsmod.Register(ModuleName, 1122, "voting power table has not been updated") ErrVotingPowerDistCacheNotFound = errorsmod.Register(ModuleName, 1123, "the voting power distribution cache is not found") ErrParamsNotFound = errorsmod.Register(ModuleName, 1124, "the parameters are not found") - ErrConsumerIDNotRegistered = errorsmod.Register(ModuleName, 1125, "Consumer is not registered") - ErrNoBabylonFPRestaked = errorsmod.Register(ModuleName, 1126, "the BTC delegation request does not restake to any Babylon finality provider") + ErrFpAlreadyJailed = errorsmod.Register(ModuleName, 1125, "the finality provider has already been jailed") + ErrFpNotJailed = errorsmod.Register(ModuleName, 1126, "the finality provider is not jailed") + ErrConsumerIDNotRegistered = errorsmod.Register(ModuleName, 1127, "Consumer is not registered") + ErrNoBabylonFPRestaked = errorsmod.Register(ModuleName, 1128, "the BTC delegation request does not restake to any Babylon finality provider") ) diff --git a/x/btcstaking/types/events.go b/x/btcstaking/types/events.go index a87dbf10e..1c9022466 100644 --- a/x/btcstaking/types/events.go +++ b/x/btcstaking/types/events.go @@ -21,3 +21,23 @@ func NewEventPowerDistUpdateWithSlashedFP(fpBTCPK *bbn.BIP340PubKey) *EventPower }, } } + +func NewEventPowerDistUpdateWithJailedFP(fpBTCPK *bbn.BIP340PubKey) *EventPowerDistUpdate { + return &EventPowerDistUpdate{ + Ev: &EventPowerDistUpdate_JailedFp{ + JailedFp: &EventPowerDistUpdate_EventJailedFinalityProvider{ + Pk: fpBTCPK, + }, + }, + } +} + +func NewEventPowerDistUpdateWithUnjailedFP(fpBTCPK *bbn.BIP340PubKey) *EventPowerDistUpdate { + return &EventPowerDistUpdate{ + Ev: &EventPowerDistUpdate_UnjailedFp{ + UnjailedFp: &EventPowerDistUpdate_EventUnjailedFinalityProvider{ + Pk: fpBTCPK, + }, + }, + } +} diff --git a/x/btcstaking/types/events.pb.go b/x/btcstaking/types/events.pb.go index c945e1f8d..bcd198fe0 100644 --- a/x/btcstaking/types/events.pb.go +++ b/x/btcstaking/types/events.pb.go @@ -184,6 +184,8 @@ type EventPowerDistUpdate struct { // // Types that are valid to be assigned to Ev: // *EventPowerDistUpdate_SlashedFp + // *EventPowerDistUpdate_JailedFp + // *EventPowerDistUpdate_UnjailedFp // *EventPowerDistUpdate_BtcDelStateUpdate Ev isEventPowerDistUpdate_Ev `protobuf_oneof:"ev"` } @@ -230,11 +232,19 @@ type isEventPowerDistUpdate_Ev interface { type EventPowerDistUpdate_SlashedFp struct { SlashedFp *EventPowerDistUpdate_EventSlashedFinalityProvider `protobuf:"bytes,1,opt,name=slashed_fp,json=slashedFp,proto3,oneof" json:"slashed_fp,omitempty"` } +type EventPowerDistUpdate_JailedFp struct { + JailedFp *EventPowerDistUpdate_EventJailedFinalityProvider `protobuf:"bytes,2,opt,name=jailed_fp,json=jailedFp,proto3,oneof" json:"jailed_fp,omitempty"` +} +type EventPowerDistUpdate_UnjailedFp struct { + UnjailedFp *EventPowerDistUpdate_EventUnjailedFinalityProvider `protobuf:"bytes,3,opt,name=unjailed_fp,json=unjailedFp,proto3,oneof" json:"unjailed_fp,omitempty"` +} type EventPowerDistUpdate_BtcDelStateUpdate struct { - BtcDelStateUpdate *EventBTCDelegationStateUpdate `protobuf:"bytes,2,opt,name=btc_del_state_update,json=btcDelStateUpdate,proto3,oneof" json:"btc_del_state_update,omitempty"` + BtcDelStateUpdate *EventBTCDelegationStateUpdate `protobuf:"bytes,4,opt,name=btc_del_state_update,json=btcDelStateUpdate,proto3,oneof" json:"btc_del_state_update,omitempty"` } func (*EventPowerDistUpdate_SlashedFp) isEventPowerDistUpdate_Ev() {} +func (*EventPowerDistUpdate_JailedFp) isEventPowerDistUpdate_Ev() {} +func (*EventPowerDistUpdate_UnjailedFp) isEventPowerDistUpdate_Ev() {} func (*EventPowerDistUpdate_BtcDelStateUpdate) isEventPowerDistUpdate_Ev() {} func (m *EventPowerDistUpdate) GetEv() isEventPowerDistUpdate_Ev { @@ -251,6 +261,20 @@ func (m *EventPowerDistUpdate) GetSlashedFp() *EventPowerDistUpdate_EventSlashed return nil } +func (m *EventPowerDistUpdate) GetJailedFp() *EventPowerDistUpdate_EventJailedFinalityProvider { + if x, ok := m.GetEv().(*EventPowerDistUpdate_JailedFp); ok { + return x.JailedFp + } + return nil +} + +func (m *EventPowerDistUpdate) GetUnjailedFp() *EventPowerDistUpdate_EventUnjailedFinalityProvider { + if x, ok := m.GetEv().(*EventPowerDistUpdate_UnjailedFp); ok { + return x.UnjailedFp + } + return nil +} + func (m *EventPowerDistUpdate) GetBtcDelStateUpdate() *EventBTCDelegationStateUpdate { if x, ok := m.GetEv().(*EventPowerDistUpdate_BtcDelStateUpdate); ok { return x.BtcDelStateUpdate @@ -262,6 +286,8 @@ func (m *EventPowerDistUpdate) GetBtcDelStateUpdate() *EventBTCDelegationStateUp func (*EventPowerDistUpdate) XXX_OneofWrappers() []interface{} { return []interface{}{ (*EventPowerDistUpdate_SlashedFp)(nil), + (*EventPowerDistUpdate_JailedFp)(nil), + (*EventPowerDistUpdate_UnjailedFp)(nil), (*EventPowerDistUpdate_BtcDelStateUpdate)(nil), } } @@ -310,12 +336,100 @@ func (m *EventPowerDistUpdate_EventSlashedFinalityProvider) XXX_DiscardUnknown() var xxx_messageInfo_EventPowerDistUpdate_EventSlashedFinalityProvider proto.InternalMessageInfo +// EventJailedFinalityProvider defines an event that a finality provider +// is jailed after being detected sluggish +type EventPowerDistUpdate_EventJailedFinalityProvider struct { + Pk *github_com_babylonlabs_io_babylon_types.BIP340PubKey `protobuf:"bytes,1,opt,name=pk,proto3,customtype=github.com/babylonlabs-io/babylon/types.BIP340PubKey" json:"pk,omitempty"` +} + +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) Reset() { + *m = EventPowerDistUpdate_EventJailedFinalityProvider{} +} +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) String() string { + return proto.CompactTextString(m) +} +func (*EventPowerDistUpdate_EventJailedFinalityProvider) ProtoMessage() {} +func (*EventPowerDistUpdate_EventJailedFinalityProvider) Descriptor() ([]byte, []int) { + return fileDescriptor_74118427820fff75, []int{3, 1} +} +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPowerDistUpdate_EventJailedFinalityProvider.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 *EventPowerDistUpdate_EventJailedFinalityProvider) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPowerDistUpdate_EventJailedFinalityProvider.Merge(m, src) +} +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) XXX_Size() int { + return m.Size() +} +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) XXX_DiscardUnknown() { + xxx_messageInfo_EventPowerDistUpdate_EventJailedFinalityProvider.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPowerDistUpdate_EventJailedFinalityProvider proto.InternalMessageInfo + +// EventUnjailedFinalityProvider defines an event that a jailed finality provider +// is unjailed after the jailing period is passed +type EventPowerDistUpdate_EventUnjailedFinalityProvider struct { + Pk *github_com_babylonlabs_io_babylon_types.BIP340PubKey `protobuf:"bytes,1,opt,name=pk,proto3,customtype=github.com/babylonlabs-io/babylon/types.BIP340PubKey" json:"pk,omitempty"` +} + +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) Reset() { + *m = EventPowerDistUpdate_EventUnjailedFinalityProvider{} +} +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) String() string { + return proto.CompactTextString(m) +} +func (*EventPowerDistUpdate_EventUnjailedFinalityProvider) ProtoMessage() {} +func (*EventPowerDistUpdate_EventUnjailedFinalityProvider) Descriptor() ([]byte, []int) { + return fileDescriptor_74118427820fff75, []int{3, 2} +} +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPowerDistUpdate_EventUnjailedFinalityProvider.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 *EventPowerDistUpdate_EventUnjailedFinalityProvider) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPowerDistUpdate_EventUnjailedFinalityProvider.Merge(m, src) +} +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) XXX_Size() int { + return m.Size() +} +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) XXX_DiscardUnknown() { + xxx_messageInfo_EventPowerDistUpdate_EventUnjailedFinalityProvider.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPowerDistUpdate_EventUnjailedFinalityProvider proto.InternalMessageInfo + func init() { proto.RegisterType((*EventNewFinalityProvider)(nil), "babylon.btcstaking.v1.EventNewFinalityProvider") proto.RegisterType((*EventBTCDelegationStateUpdate)(nil), "babylon.btcstaking.v1.EventBTCDelegationStateUpdate") proto.RegisterType((*EventSelectiveSlashing)(nil), "babylon.btcstaking.v1.EventSelectiveSlashing") proto.RegisterType((*EventPowerDistUpdate)(nil), "babylon.btcstaking.v1.EventPowerDistUpdate") proto.RegisterType((*EventPowerDistUpdate_EventSlashedFinalityProvider)(nil), "babylon.btcstaking.v1.EventPowerDistUpdate.EventSlashedFinalityProvider") + proto.RegisterType((*EventPowerDistUpdate_EventJailedFinalityProvider)(nil), "babylon.btcstaking.v1.EventPowerDistUpdate.EventJailedFinalityProvider") + proto.RegisterType((*EventPowerDistUpdate_EventUnjailedFinalityProvider)(nil), "babylon.btcstaking.v1.EventPowerDistUpdate.EventUnjailedFinalityProvider") } func init() { @@ -323,37 +437,41 @@ func init() { } var fileDescriptor_74118427820fff75 = []byte{ - // 466 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcd, 0x6e, 0xd3, 0x40, - 0x14, 0x85, 0x6d, 0x0b, 0xa1, 0x66, 0xca, 0x8f, 0xb0, 0x02, 0x8a, 0x22, 0x30, 0x95, 0x17, 0xa5, - 0x42, 0xc2, 0x6e, 0xd3, 0x48, 0xb0, 0x36, 0x69, 0x31, 0x02, 0x55, 0x91, 0x5d, 0x36, 0x6c, 0xac, - 0x19, 0xe7, 0xc6, 0x1e, 0xc5, 0xcc, 0x58, 0x99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xb9, 0xc5, - 0x9a, 0x88, 0x68, 0x87, 0xc1, 0x54, 0x61, 0xdd, 0x21, 0x7a, 0xa1, 0x1a, 0xc5, 0x50, 0x40, 0x2a, - 0x69, 0x05, 0x71, 0x81, 0x45, 0x4e, 0x59, 0x66, 0x7f, 0x45, 0x3b, 0x50, 0x57, 0x67, 0x29, 0xe8, - 0x5d, 0x0f, 0xb7, 0x10, 0x6e, 0x79, 0x4f, 0xb4, 0x2f, 0xba, 0x4e, 0x70, 0xaf, 0x2c, 0xd4, 0x54, - 0xa0, 0x3e, 0x9f, 0xc2, 0xb8, 0x47, 0x85, 0xd4, 0x1b, 0x53, 0x84, 0x44, 0x6d, 0x83, 0x41, 0x72, - 0x7d, 0xd4, 0x70, 0x0b, 0x68, 0x53, 0xc0, 0x6a, 0x18, 0xaf, 0x22, 0x6e, 0x5e, 0x3d, 0x34, 0xa2, - 0x86, 0x4e, 0x3f, 0x2d, 0xed, 0x0c, 0x35, 0x89, 0x4c, 0x93, 0x01, 0x14, 0xab, 0xc3, 0x25, 0x13, - 0x95, 0xa0, 0xee, 0xb7, 0xdb, 0xe9, 0xde, 0x05, 0xdd, 0xf6, 0xc1, 0x42, 0x23, 0x7a, 0x46, 0x64, - 0xda, 0x83, 0x62, 0x6d, 0xd8, 0xce, 0xd1, 0xcb, 0xbb, 0x5a, 0xd9, 0x21, 0xb2, 0xca, 0x91, 0xda, - 0xf5, 0x51, 0xf0, 0xe1, 0xea, 0xf7, 0xeb, 0x6e, 0x46, 0x65, 0x3e, 0x21, 0x5e, 0xca, 0x7f, 0xf8, - 0xba, 0x44, 0x81, 0x89, 0x78, 0x47, 0xf9, 0xbf, 0xbf, 0xbe, 0x9c, 0x97, 0x20, 0xbc, 0xe0, 0x73, - 0xff, 0xb8, 0x7b, 0xd8, 0x9f, 0x90, 0x2f, 0x30, 0x8f, 0xac, 0x72, 0x14, 0x3c, 0x40, 0x16, 0x54, - 0xc1, 0xd9, 0xcf, 0x85, 0x63, 0x5e, 0x2e, 0x1c, 0xf3, 0xcf, 0xc2, 0x31, 0x2f, 0x96, 0x8e, 0x71, - 0xb9, 0x74, 0x8c, 0x5f, 0x4b, 0xc7, 0xf8, 0x7e, 0x8f, 0xe4, 0xd9, 0xfa, 0x53, 0x50, 0x18, 0xf2, - 0x50, 0xbd, 0x81, 0xe3, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x5a, 0xe3, 0x63, 0x7e, 0x03, - 0x00, 0x00, + // 531 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4d, 0x6f, 0xd3, 0x30, + 0x18, 0xc7, 0x9b, 0x30, 0x4d, 0xab, 0xc7, 0x8b, 0x88, 0x0a, 0xaa, 0x0a, 0x84, 0xa9, 0x87, 0x31, + 0x21, 0x91, 0xec, 0xa5, 0x12, 0x9c, 0x4b, 0xd7, 0x75, 0x80, 0xa6, 0x2a, 0xdd, 0x2e, 0x5c, 0x22, + 0x27, 0x7d, 0x9a, 0x98, 0x06, 0xdb, 0xaa, 0xdd, 0xb4, 0xbd, 0xf3, 0x01, 0xf6, 0xb1, 0x38, 0xee, + 0x88, 0x38, 0x20, 0xd4, 0x7e, 0x11, 0x54, 0xc7, 0xdb, 0xaa, 0xad, 0xa9, 0x98, 0xb4, 0x5b, 0x62, + 0x3d, 0xff, 0xdf, 0xef, 0xf1, 0x13, 0xc7, 0xa8, 0x1a, 0xe0, 0x60, 0x92, 0x30, 0xea, 0x06, 0x32, + 0x14, 0x12, 0xf7, 0x09, 0x8d, 0xdc, 0x74, 0xcf, 0x85, 0x14, 0xa8, 0x14, 0x0e, 0x1f, 0x30, 0xc9, + 0xac, 0x67, 0xba, 0xc6, 0xb9, 0xae, 0x71, 0xd2, 0xbd, 0x4a, 0x29, 0x62, 0x11, 0x53, 0x15, 0xee, + 0xfc, 0x29, 0x2b, 0xae, 0x6c, 0x2f, 0x07, 0x2e, 0x44, 0x55, 0x5d, 0xb5, 0x83, 0xca, 0x87, 0x73, + 0xc9, 0x09, 0x8c, 0x9a, 0x84, 0xe2, 0x84, 0xc8, 0x49, 0x7b, 0xc0, 0x52, 0xd2, 0x85, 0x81, 0xf5, + 0x1e, 0x99, 0x3d, 0x5e, 0x36, 0xb6, 0x8c, 0x9d, 0xcd, 0xfd, 0x37, 0xce, 0x52, 0xbb, 0x73, 0x33, + 0xe4, 0x99, 0x3d, 0x5e, 0x3d, 0x37, 0xd0, 0x2b, 0x45, 0xad, 0x9f, 0x7e, 0x6c, 0x40, 0x02, 0x11, + 0x96, 0x84, 0xd1, 0x8e, 0xc4, 0x12, 0xce, 0x78, 0x17, 0x4b, 0xb0, 0xb6, 0xd1, 0x13, 0x0d, 0xf1, + 0xe5, 0xd8, 0x8f, 0xb1, 0x88, 0x95, 0xa7, 0xe8, 0x3d, 0xd2, 0xcb, 0xa7, 0xe3, 0x16, 0x16, 0xb1, + 0x75, 0x84, 0x8a, 0x14, 0x46, 0xbe, 0x98, 0x47, 0xcb, 0xe6, 0x96, 0xb1, 0xf3, 0x78, 0xff, 0x6d, + 0x4e, 0x27, 0xb7, 0x5c, 0x43, 0xe1, 0x6d, 0x50, 0x18, 0x29, 0x6d, 0xb5, 0x87, 0x9e, 0xab, 0x8e, + 0x3a, 0x90, 0x40, 0x28, 0x49, 0x0a, 0x9d, 0x04, 0x8b, 0x98, 0xd0, 0xc8, 0xfa, 0x82, 0x36, 0x60, + 0xde, 0x3a, 0x0d, 0x41, 0xef, 0x75, 0x37, 0xc7, 0x70, 0x2b, 0x7b, 0xa8, 0x73, 0xde, 0x15, 0xa1, + 0xfa, 0x63, 0x1d, 0x95, 0x94, 0xa8, 0xcd, 0x46, 0x30, 0x68, 0x10, 0x21, 0xf5, 0x8e, 0x09, 0x42, + 0x62, 0x1e, 0x83, 0xae, 0x7f, 0x35, 0xd4, 0x56, 0x8e, 0x68, 0x19, 0x20, 0x5b, 0xec, 0x64, 0x88,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17, 0xbe, 0xfe, 0x07, 0x79, 0xbc, 0x78, 0x69, 0x29, 0x4d, + 0xb0, 0xae, 0x6e, 0xab, 0x83, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x09, 0xde, 0x05, 0x65, 0x28, + 0x05, 0x00, 0x00, } func (m *EventNewFinalityProvider) Marshal() (dAtA []byte, err error) { @@ -514,6 +632,48 @@ func (m *EventPowerDistUpdate_SlashedFp) MarshalToSizedBuffer(dAtA []byte) (int, } return len(dAtA) - i, nil } +func (m *EventPowerDistUpdate_JailedFp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPowerDistUpdate_JailedFp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.JailedFp != nil { + { + size, err := m.JailedFp.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *EventPowerDistUpdate_UnjailedFp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPowerDistUpdate_UnjailedFp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.UnjailedFp != nil { + { + size, err := m.UnjailedFp.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} func (m *EventPowerDistUpdate_BtcDelStateUpdate) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -531,7 +691,7 @@ func (m *EventPowerDistUpdate_BtcDelStateUpdate) MarshalToSizedBuffer(dAtA []byt i = encodeVarintEvents(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x22 } return len(dAtA) - i, nil } @@ -570,6 +730,76 @@ func (m *EventPowerDistUpdate_EventSlashedFinalityProvider) MarshalToSizedBuffer return len(dAtA) - i, nil } +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) 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 *EventPowerDistUpdate_EventJailedFinalityProvider) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pk != nil { + { + size := m.Pk.Size() + i -= size + if _, err := m.Pk.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) 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 *EventPowerDistUpdate_EventUnjailedFinalityProvider) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pk != nil { + { + size := m.Pk.Size() + i -= size + if _, err := m.Pk.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -647,6 +877,30 @@ func (m *EventPowerDistUpdate_SlashedFp) Size() (n int) { } return n } +func (m *EventPowerDistUpdate_JailedFp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.JailedFp != nil { + l = m.JailedFp.Size() + n += 1 + l + sovEvents(uint64(l)) + } + return n +} +func (m *EventPowerDistUpdate_UnjailedFp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.UnjailedFp != nil { + l = m.UnjailedFp.Size() + n += 1 + l + sovEvents(uint64(l)) + } + return n +} func (m *EventPowerDistUpdate_BtcDelStateUpdate) Size() (n int) { if m == nil { return 0 @@ -672,6 +926,32 @@ func (m *EventPowerDistUpdate_EventSlashedFinalityProvider) Size() (n int) { return n } +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pk != nil { + l = m.Pk.Size() + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pk != nil { + l = m.Pk.Size() + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1016,6 +1296,76 @@ func (m *EventPowerDistUpdate) Unmarshal(dAtA []byte) error { m.Ev = &EventPowerDistUpdate_SlashedFp{v} iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JailedFp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &EventPowerDistUpdate_EventJailedFinalityProvider{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Ev = &EventPowerDistUpdate_JailedFp{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnjailedFp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &EventPowerDistUpdate_EventUnjailedFinalityProvider{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Ev = &EventPowerDistUpdate_UnjailedFp{v} + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BtcDelStateUpdate", wireType) } @@ -1156,6 +1506,176 @@ func (m *EventPowerDistUpdate_EventSlashedFinalityProvider) Unmarshal(dAtA []byt } return nil } +func (m *EventPowerDistUpdate_EventJailedFinalityProvider) 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 ErrIntOverflowEvents + } + 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: EventJailedFinalityProvider: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventJailedFinalityProvider: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pk", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_babylonlabs_io_babylon_types.BIP340PubKey + m.Pk = &v + if err := m.Pk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) 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 ErrIntOverflowEvents + } + 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: EventUnjailedFinalityProvider: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventUnjailedFinalityProvider: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pk", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_babylonlabs_io_babylon_types.BIP340PubKey + m.Pk = &v + if err := m.Pk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/btcstaking/types/incentive.go b/x/btcstaking/types/incentive.go index e6955ee2f..41cc24de5 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) + SortFinalityProvidersWithZeroedVotingPower(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, -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, 0x07, 0xcb, 0x62, 0xeb, 0xbb, 0x04, - 0x6a, 0x7f, 0x8e, 0xf8, 0xf7, 0xbe, 0x3f, 0x06, 0xe5, 0x64, 0x61, 0x12, 0x99, 0xd7, 0xb2, 0x1f, - 0x64, 0xe4, 0xa4, 0x08, 0xef, 0x83, 0xff, 0x73, 0xad, 0xa6, 0x98, 0x98, 0x2e, 0xe2, 0x6e, 0x96, - 0x84, 0x51, 0xcd, 0xcb, 0x83, 0xc9, 0x33, 0xc4, 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, 0x66, 0x9a, 0x09, 0x29, 0xf0, 0xcd, 0x8a, 0x66, 0x0e, 0x69, + 0x66, 0xbe, 0xb5, 0xb2, 0x1c, 0x88, 0x40, 0x28, 0x86, 0x55, 0x7c, 0x95, 0xe4, 0x95, 0x5b, 0x54, + 0x40, 0x2c, 0xc0, 0x2d, 0x81, 0xb2, 0x28, 0xa1, 0xf5, 0x13, 0x0d, 0x2d, 0xbf, 0x11, 0x92, 0x27, + 0x41, 0x47, 0x7c, 0x60, 0x59, 0x9b, 0x83, 0xdc, 0x23, 0x34, 0x64, 0x78, 0x13, 0x61, 0x29, 0x24, + 0x89, 0xdc, 0x5c, 0xa1, 0x6e, 0x5a, 0xc0, 0xba, 0xd6, 0xd0, 0x9a, 0x75, 0xe7, 0x7f, 0x85, 0x8c, + 0x8c, 0xe1, 0x77, 0x08, 0x77, 0x79, 0x42, 0x22, 0x2e, 0x07, 0xc5, 0x29, 0x39, 0xf7, 0x59, 0x06, + 0xfa, 0x44, 0x63, 0xb2, 0x39, 0x7f, 0xdf, 0x32, 0xaf, 0xbc, 0xab, 0xb9, 0x5f, 0x0d, 0x74, 0x2a, + 0x7e, 0x71, 0xf6, 0x41, 0xd2, 0x15, 0xce, 0x8d, 0xee, 0x5f, 0x08, 0xe0, 0x3b, 0x68, 0x29, 0xe9, + 0xc7, 0x2e, 0xa1, 0x85, 0x05, 0x6e, 0x37, 0x05, 0x7d, 0xb2, 0xa1, 0x35, 0x17, 0x9d, 0x85, 0xa4, + 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, 0x80, 0x37, 0xd0, 0x12, 0x07, 0x57, 0xf2, 0x98, 0x81, 0x24, 0x71, + 0xca, 0x7c, 0x7d, 0xba, 0xa1, 0x35, 0x67, 0x9d, 0x45, 0x0e, 0x87, 0xc3, 0x26, 0x5e, 0x45, 0x73, + 0x1c, 0xdc, 0xf7, 0x84, 0x47, 0xcc, 0xd7, 0x67, 0x14, 0x63, 0x96, 0xc3, 0x53, 0x55, 0xaf, 0xff, + 0xd0, 0xd0, 0xd2, 0x9f, 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:]) diff --git a/x/btcstaking/types/query.go b/x/btcstaking/types/query.go index 836637a9d..d5dee31c4 100644 --- a/x/btcstaking/types/query.go +++ b/x/btcstaking/types/query.go @@ -66,7 +66,7 @@ func NewFinalityProviderResponse(f *FinalityProvider, bbnBlockHeight, votingPowe Pop: f.Pop, SlashedBabylonHeight: f.SlashedBabylonHeight, SlashedBtcHeight: f.SlashedBtcHeight, - Sluggish: f.Sluggish, + Jailed: f.Jailed, Height: bbnBlockHeight, VotingPower: votingPower, } diff --git a/x/btcstaking/types/query.pb.go b/x/btcstaking/types/query.pb.go index dc710bb9f..91b814236 100644 --- a/x/btcstaking/types/query.pb.go +++ b/x/btcstaking/types/query.pb.go @@ -1504,8 +1504,8 @@ type FinalityProviderResponse struct { Height uint64 `protobuf:"varint,8,opt,name=height,proto3" json:"height,omitempty"` // voting_power is the voting power of this finality provider at the given height VotingPower uint64 `protobuf:"varint,9,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` - // sluggish defines whether the finality provider is detected sluggish - Sluggish bool `protobuf:"varint,10,opt,name=sluggish,proto3" json:"sluggish,omitempty"` + // jailed defines whether the finality provider is jailed + Jailed bool `protobuf:"varint,10,opt,name=jailed,proto3" json:"jailed,omitempty"` } func (m *FinalityProviderResponse) Reset() { *m = FinalityProviderResponse{} } @@ -1590,9 +1590,9 @@ func (m *FinalityProviderResponse) GetVotingPower() uint64 { return 0 } -func (m *FinalityProviderResponse) GetSluggish() bool { +func (m *FinalityProviderResponse) GetJailed() bool { if m != nil { - return m.Sluggish + return m.Jailed } return false } @@ -1629,126 +1629,125 @@ func init() { func init() { proto.RegisterFile("babylon/btcstaking/v1/query.proto", fileDescriptor_74d49d26f7429697) } var fileDescriptor_74d49d26f7429697 = []byte{ - // 1889 bytes of a gzipped FileDescriptorProto + // 1887 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x4b, 0x6c, 0xdb, 0xc8, - 0x19, 0x0e, 0x6d, 0x45, 0xb1, 0x7f, 0xd9, 0x8e, 0x33, 0xeb, 0x24, 0x8c, 0x1c, 0xdb, 0x09, 0x9b, + 0x19, 0x0e, 0x6d, 0x45, 0x89, 0x7f, 0xd9, 0x8e, 0x33, 0xeb, 0x24, 0x8c, 0x1c, 0xdb, 0x09, 0x9b, 0x4d, 0x9c, 0x87, 0xc5, 0x58, 0xf1, 0x6e, 0x1f, 0xdb, 0xdd, 0xc4, 0xb2, 0x77, 0x93, 0xec, 0xae, - 0x1b, 0x95, 0x4e, 0x5a, 0xa0, 0x2f, 0x81, 0xa2, 0x46, 0x14, 0x11, 0x99, 0xc3, 0x70, 0x46, 0xae, - 0x8c, 0xc0, 0x97, 0x1e, 0x7a, 0x2b, 0x50, 0xa0, 0xbd, 0xf6, 0xdc, 0x16, 0x3d, 0x36, 0xa7, 0x02, - 0xbd, 0x6f, 0x6f, 0x8b, 0xf4, 0xb0, 0x45, 0x0e, 0x41, 0x91, 0x14, 0x2d, 0x50, 0xa0, 0xd7, 0x9e, - 0x0b, 0xce, 0x0c, 0x45, 0x4a, 0x22, 0x65, 0xc9, 0x76, 0x6f, 0xd6, 0xcc, 0xff, 0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+ 0xbb, 0x87, 0x37, 0x20, 0xb3, 0xbe, 0xc7, 0xb3, 0xde, 0x40, 0x77, 0xde, 0x30, 0x6b, 0xce, 0xd8, + 0x7d, 0x63, 0x85, 0xe1, 0x8c, 0x9d, 0x3c, 0xa2, 0x18, 0xce, 0xd8, 0x29, 0x73, 0x8b, 0x03, 0x19, + 0xdb, 0x0c, 0xf5, 0xe4, 0xed, 0x8a, 0xfe, 0xab, 0xc0, 0xc2, 0x90, 0xa1, 0x01, 0xfa, 0x60, 0x9c, + 0xc2, 0x26, 0x10, 0xc8, 0x9d, 0x43, 0xeb, 0xcb, 0x8c, 0xb6, 0x79, 0x46, 0xf7, 0xd0, 0x87, 0x87, + 0x3f, 0x97, 0x38, 0xd9, 0xfc, 0x59, 0x81, 0x99, 0x1e, 0xde, 0x42, 0xb7, 0x46, 0xa6, 0xb8, 0x30, + 0xa7, 0xb5, 0x31, 0x34, 0x64, 0x16, 0x5b, 0x3c, 0x8b, 0x0f, 0xd0, 0xb7, 0x47, 0xe3, 0x44, 0xfd, + 0x59, 0xc2, 0x1c, 0x63, 0xbf, 0xf4, 0x9d, 0xcf, 0x5e, 0x2d, 0x29, 0x9f, 0xbf, 0x5a, 0x52, 0xfe, + 0xf1, 0x6a, 0x49, 0xf9, 0xd5, 0xeb, 0xa5, 0x63, 0x9f, 0xbf, 0x5e, 0x3a, 0xf6, 0xf7, 0xd7, 0x4b, + 0xc7, 0x7e, 0x30, 0xc2, 0xc7, 0x5e, 0x27, 0xee, 0x92, 0x7f, 0xf9, 0x55, 0xb3, 0xfc, 0xff, 0x4c, + 0xb7, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xfa, 0xfe, 0xb7, 0xb1, 0x1b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3280,9 +3279,9 @@ func (m *FinalityProviderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.Sluggish { + if m.Jailed { i-- - if m.Sluggish { + if m.Jailed { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -3849,7 +3848,7 @@ func (m *FinalityProviderResponse) Size() (n int) { if m.VotingPower != 0 { n += 1 + sovQuery(uint64(m.VotingPower)) } - if m.Sluggish { + if m.Jailed { n += 2 } return n @@ -6931,7 +6930,7 @@ func (m *FinalityProviderResponse) Unmarshal(dAtA []byte) error { } case 10: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sluggish", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -6948,7 +6947,7 @@ func (m *FinalityProviderResponse) Unmarshal(dAtA []byte) error { break } } - m.Sluggish = bool(v != 0) + m.Jailed = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/epoching/keeper/msg_server.go b/x/epoching/keeper/msg_server.go index 280abec88..b5bde0b46 100644 --- a/x/epoching/keeper/msg_server.go +++ b/x/epoching/keeper/msg_server.go @@ -4,11 +4,12 @@ import ( "context" errorsmod "cosmossdk.io/errors" - "github.com/babylonlabs-io/babylon/x/epoching/types" "github.com/cometbft/cometbft/crypto/tmhash" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/babylonlabs-io/babylon/x/epoching/types" ) type msgServer struct { @@ -242,7 +243,7 @@ func (ms msgServer) WrappedCancelUnbondingDelegation(goCtx context.Context, msg ) } - blockHeight := uint64(ctx.BlockHeader().Height) + blockHeight := uint64(ctx.HeaderInfo().Height) if blockHeight == 0 { return nil, types.ErrZeroEpochMsg } diff --git a/x/finality/keeper/liveness.go b/x/finality/keeper/liveness.go index f46e52b37..314216999 100644 --- a/x/finality/keeper/liveness.go +++ b/x/finality/keeper/liveness.go @@ -11,7 +11,7 @@ import ( ) // HandleLiveness handles liveness of each active finality provider for a given height -// including identifying sluggish finality providers and applying punishment (TBD) +// including jailing sluggish finality providers and applying punishment (TBD) func (k Keeper) HandleLiveness(ctx context.Context, height int64) { // get all the active finality providers for the height fpSet := k.BTCStakingKeeper.GetVotingPowerTable(ctx, uint64(height)) @@ -38,17 +38,26 @@ func (k Keeper) HandleLiveness(ctx context.Context, height int64) { } // HandleFinalityProviderLiveness updates the voting history of the given finality provider and -// detect sluggish the finality provider if the number of missed block is reached to the threshold in a +// jail sluggish the finality provider if the number of missed block is reached to the threshold in a // sliding window func (k Keeper) HandleFinalityProviderLiveness(ctx context.Context, fpPk *types.BIP340PubKey, missed bool, height int64) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) params := k.GetParams(ctx) + fp, err := k.BTCStakingKeeper.GetFinalityProvider(ctx, fpPk.MustMarshal()) if err != nil { return err } - // don't update missed blocks when finality provider is already detected slashed - if fp.IsSlashed() { + // don't update missed blocks when finality provider is already slashed or jailed + if fp.IsSlashed() || fp.IsJailed() { + k.Logger(sdkCtx).Debug( + "skip handling liveness", + "height", height, + "public_key", fpPk.MarshalHex(), + "is_slashed", fp.IsSlashed(), + "is_jailed", fp.IsJailed(), + ) return nil } @@ -60,7 +69,6 @@ func (k Keeper) HandleFinalityProviderLiveness(ctx context.Context, fpPk *types. signedBlocksWindow := params.SignedBlocksWindow minSignedPerWindow := params.MinSignedPerWindowInt() - sdkCtx := sdk.UnwrapSDKContext(ctx) if missed { k.Logger(sdkCtx).Debug( "absent finality provider", @@ -74,54 +82,28 @@ func (k Keeper) HandleFinalityProviderLiveness(ctx context.Context, fpPk *types. minHeight := signInfo.StartHeight + signedBlocksWindow maxMissed := signedBlocksWindow - minSignedPerWindow - // if we are past the minimum height and the finality provider has missed too many blocks, punish them + // if the number of missed block reaches the threshold within the sliding window + // jail the finality provider if height > minHeight && signInfo.MissedBlocksCounter > maxMissed { updated = true - k.Logger(sdkCtx).Info( - "detected sluggish finality provider", - "height", height, - "public_key", fpPk.MarshalHex(), - "missed_count", signInfo.MissedBlocksCounter, - "threshold", minSignedPerWindow, - "window_size", signedBlocksWindow, - ) - - // Inactivity detected - err = k.hooks.AfterSluggishFinalityProviderDetected(ctx, fpPk) - if err != nil { - return err + if err := k.jailSluggishFinalityProvider(ctx, fpPk); err != nil { + return fmt.Errorf("failed to jail sluggish finality provider %s: %w", fpPk.MarshalHex(), err) } - if err := sdkCtx.EventManager().EmitTypedEvent( - finalitytypes.NewEventSluggishFinalityProviderDetected(fpPk), - ); err != nil { - panic(fmt.Errorf("failed to emit sluggish finality provider detected event for height %d: %w", height, err)) + signInfo.JailedUntil = sdkCtx.HeaderInfo().Time.Add(params.JailDuration) + // we need to reset the counter & bitmap so that the finality provider won't be + // immediately jailed after unjailing. + signInfo.MissedBlocksCounter = 0 + if err := k.DeleteMissedBlockBitmap(ctx, fpPk); err != nil { + return fmt.Errorf("failed to remove the missed block bit map: %w", err) } - finalitytypes.IncrementSluggishFinalityProviderCounter() - } else if fp.IsSluggish() { - updated = true - k.Logger(sdkCtx).Info( - "reverted sluggish finality provider", + "finality provider is jailed", "height", height, "public_key", fpPk.MarshalHex(), ) - - // change the sluggish flag of the finality provider to false - err = k.BTCStakingKeeper.RevertSluggishFinalityProvider(ctx, fpPk.MustMarshal()) - if err != nil { - return fmt.Errorf("failed to revert sluggish finality provider %s: %w", fpPk.MarshalHex(), err) - } - - if err := sdkCtx.EventManager().EmitTypedEvent( - finalitytypes.NewEventSluggishFinalityProviderReverted(fpPk), - ); err != nil { - panic(fmt.Errorf("failed to emit sluggish finality provider reverted event for height %d: %w", height, err)) - } - - finalitytypes.DecrementSluggishFinalityProviderCounter() } // Set the updated signing info @@ -200,3 +182,21 @@ func (k Keeper) updateSigningInfo( return modifiedSignInfo, &signInfo, nil } + +func (k Keeper) jailSluggishFinalityProvider(ctx context.Context, fpBtcPk *types.BIP340PubKey) error { + err := k.hooks.AfterSluggishFinalityProviderDetected(ctx, fpBtcPk) + if err != nil { + return err + } + + err = sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent( + finalitytypes.NewEventJailedFinalityProvider(fpBtcPk), + ) + if err != nil { + return fmt.Errorf("failed to emit sluggish finality provider detected event: %w", err) + } + + finalitytypes.IncrementJailedFinalityProviderCounter() + + return nil +} diff --git a/x/finality/keeper/liveness_test.go b/x/finality/keeper/liveness_test.go index 74f25f2d6..5eb1bda51 100644 --- a/x/finality/keeper/liveness_test.go +++ b/x/finality/keeper/liveness_test.go @@ -3,7 +3,9 @@ package keeper_test import ( "math/rand" "testing" + "time" + "cosmossdk.io/core/header" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -26,6 +28,8 @@ func FuzzHandleLiveness(f *testing.F) { iKeeper := types.NewMockIncentiveKeeper(ctrl) cKeeper := types.NewMockCheckpointingKeeper(ctrl) fKeeper, ctx := keepertest.FinalityKeeper(t, bsKeeper, iKeeper, cKeeper) + blockTime := time.Now() + ctx = ctx.WithHeaderInfo(header.Info{Time: blockTime}) mockedHooks := types.NewMockFinalityHooks(ctrl) mockedHooks.EXPECT().AfterSluggishFinalityProviderDetected(gomock.Any(), gomock.Any()).Return(nil).AnyTimes() @@ -34,7 +38,7 @@ func FuzzHandleLiveness(f *testing.F) { params := fKeeper.GetParams(ctx) fpPk, err := datagen.GenRandomBIP340PubKey(r) require.NoError(t, err) - bsKeeper.EXPECT().GetFinalityProvider(gomock.Any(), fpPk.MustMarshal()).Return(&bstypes.FinalityProvider{Sluggish: false}, nil).AnyTimes() + bsKeeper.EXPECT().GetFinalityProvider(gomock.Any(), fpPk.MustMarshal()).Return(&bstypes.FinalityProvider{Jailed: false}, nil).AnyTimes() signingInfo := types.NewFinalityProviderSigningInfo( fpPk, 1, @@ -59,33 +63,21 @@ func FuzzHandleLiveness(f *testing.F) { minSignedPerWindow := params.MinSignedPerWindowInt() maxMissed := params.SignedBlocksWindow - minSignedPerWindow // for blocks up to the inactivity boundary, mark the finality provider as having not signed - sluggishDetectedHeight := height + maxMissed + 1 + sluggishDetectedHeight := height + maxMissed for ; height < sluggishDetectedHeight; height++ { err := fKeeper.HandleFinalityProviderLiveness(ctx, fpPk, true, height) require.NoError(t, err) signingInfo, err = fKeeper.FinalityProviderSigningTracker.Get(ctx, fpPk.MustMarshal()) require.NoError(t, err) - if height < sluggishDetectedHeight-1 { - require.GreaterOrEqual(t, maxMissed, signingInfo.MissedBlocksCounter) - } else { - require.Less(t, maxMissed, signingInfo.MissedBlocksCounter) - } + require.GreaterOrEqual(t, maxMissed, signingInfo.MissedBlocksCounter) } - // perform heights that not missed, expect the sluggish is reverted - bsKeeper.EXPECT().RevertSluggishFinalityProvider(gomock.Any(), fpPk.MustMarshal()).Return(nil).AnyTimes() - sluggishRevertedHeight := height + maxMissed - for ; height < sluggishRevertedHeight; height++ { - err := fKeeper.HandleFinalityProviderLiveness(ctx, fpPk, false, height) - require.NoError(t, err) - signingInfo, err = fKeeper.FinalityProviderSigningTracker.Get(ctx, fpPk.MustMarshal()) - require.NoError(t, err) - if height < sluggishRevertedHeight-1 { - require.Less(t, maxMissed, signingInfo.MissedBlocksCounter) - } else { - // the sluggish fp is reverted - require.Equal(t, maxMissed, signingInfo.MissedBlocksCounter) - } - } + // after next height, the fp will be jailed + err = fKeeper.HandleFinalityProviderLiveness(ctx, fpPk, true, height) + require.NoError(t, err) + signingInfo, err = fKeeper.FinalityProviderSigningTracker.Get(ctx, fpPk.MustMarshal()) + require.NoError(t, err) + require.Equal(t, blockTime.Add(params.JailDuration).Unix(), signingInfo.JailedUntil.Unix()) + require.Equal(t, int64(0), signingInfo.MissedBlocksCounter) }) } diff --git a/x/finality/keeper/msg_server.go b/x/finality/keeper/msg_server.go index 6008bbb0e..ed4f5610b 100644 --- a/x/finality/keeper/msg_server.go +++ b/x/finality/keeper/msg_server.go @@ -49,6 +49,11 @@ func (ms msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdatePara func (ms msgServer) AddFinalitySig(goCtx context.Context, req *types.MsgAddFinalitySig) (*types.MsgAddFinalitySigResponse, error) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), types.MetricsKeyAddFinalitySig) + if req.FpBtcPk == nil { + return nil, types.ErrInvalidFinalitySig.Wrap("empty finality provider BTC PK") + } + fpPK := req.FpBtcPk + ctx := sdk.UnwrapSDKContext(goCtx) // ensure the finality provider exists @@ -74,14 +79,14 @@ func (ms msgServer) AddFinalitySig(goCtx context.Context, req *types.MsgAddFinal // corrupt a new finality provider and equivocate a historical block over and over again, making a previous block // unfinalisable forever if fp.IsSlashed() { - return nil, bstypes.ErrFpAlreadySlashed + return nil, bstypes.ErrFpAlreadySlashed.Wrapf(fmt.Sprintf("finality provider public key: %s", fpPK.MarshalHex())) } - // ensure the finality provider has voting power at this height - if req.FpBtcPk == nil { - return nil, types.ErrInvalidFinalitySig.Wrap("empty finality provider BTC PK") + if fp.IsJailed() { + return nil, bstypes.ErrFpAlreadyJailed.Wrapf(fmt.Sprintf("finality provider public key: %s", fpPK.MarshalHex())) } - fpPK := req.FpBtcPk + + // ensure the finality provider has voting power at this height if ms.BTCStakingKeeper.GetVotingPower(ctx, fpPK.MustMarshal(), req.BlockHeight) == 0 { return nil, types.ErrInvalidFinalitySig.Wrapf("the finality provider %s does not have voting power at height %d", fpPK.MarshalHex(), req.BlockHeight) } @@ -232,6 +237,54 @@ func (ms msgServer) CommitPubRandList(goCtx context.Context, req *types.MsgCommi return &types.MsgCommitPubRandListResponse{}, nil } +// UnjailFinalityProvider unjails a jailed finality provider +func (ms msgServer) UnjailFinalityProvider(ctx context.Context, req *types.MsgUnjailFinalityProvider) (*types.MsgUnjailFinalityProviderResponse, error) { + defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), types.MetricsKeyUnjailFinalityProvider) + + // ensure finality provider exists + fpPk := req.FpBtcPk + fp, err := ms.BTCStakingKeeper.GetFinalityProvider(ctx, fpPk.MustMarshal()) + if err != nil { + return nil, fmt.Errorf("failed to get finality provider %s: %w", fpPk.MarshalHex(), err) + } + + // ensure the signer's address matches the fp's address + if fp.Addr != req.Signer { + return nil, fmt.Errorf("the fp's address %s does not match the signer %s of the requestion", fp.Addr, req.Signer) + } + + // ensure finality provider is already jailed + if !fp.IsJailed() { + return nil, bstypes.ErrFpNotJailed + } + + info, err := ms.FinalityProviderSigningTracker.Get(ctx, fpPk.MustMarshal()) + if err != nil { + return nil, fmt.Errorf("failed to get the signing info of finality provider %s: %w", fpPk.MarshalHex(), err) + } + + // cannot be unjailed until jailing period is passed + sdkCtx := sdk.UnwrapSDKContext(ctx) + curBlockTime := sdkCtx.HeaderInfo().Time + jailingPeriodPassed, err := info.IsJailingPeriodPassed(curBlockTime) + if err != nil { + return nil, err + } + if !jailingPeriodPassed { + return nil, types.ErrJailingPeriodNotPassed.Wrapf( + fmt.Sprintf("current block time: %v, required %v", curBlockTime, info.JailedUntil)) + } + + err = ms.BTCStakingKeeper.UnjailFinalityProvider(ctx, fpPk.MustMarshal()) + if err != nil { + return nil, fmt.Errorf("failed to unjail finality provider %s: %w", fpPk.MarshalHex(), err) + } + + types.DecrementJailedFinalityProviderCounter() + + return &types.MsgUnjailFinalityProviderResponse{}, nil +} + // slashFinalityProvider slashes a finality provider with the given evidence // including setting its voting power to zero, extracting its BTC SK, // and emit an event diff --git a/x/finality/keeper/msg_server_test.go b/x/finality/keeper/msg_server_test.go index 763afa3b3..7a595d0c0 100644 --- a/x/finality/keeper/msg_server_test.go +++ b/x/finality/keeper/msg_server_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "context" + "fmt" "math/rand" "testing" "time" @@ -229,7 +230,79 @@ func FuzzAddFinalitySig(f *testing.F) { fp.SlashedBabylonHeight = blockHeight bsKeeper.EXPECT().GetFinalityProvider(gomock.Any(), gomock.Eq(fpBTCPKBytes)).Return(fp, nil).Times(1) _, err = ms.AddFinalitySig(ctx, msg) - require.Equal(t, bstypes.ErrFpAlreadySlashed, err) + require.ErrorIs(t, err, bstypes.ErrFpAlreadySlashed) + + // Case 7: jailed finality provider cannot vote + fp.Jailed = true + fp.SlashedBabylonHeight = 0 + bsKeeper.EXPECT().GetFinalityProvider(gomock.Any(), gomock.Eq(fpBTCPKBytes)).Return(fp, nil).Times(1) + _, err = ms.AddFinalitySig(ctx, msg) + require.ErrorIs(t, err, bstypes.ErrFpAlreadyJailed) + }) +} + +func FuzzUnjailFinalityProvider(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 100) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + bsKeeper := types.NewMockBTCStakingKeeper(ctrl) + cKeeper := types.NewMockCheckpointingKeeper(ctrl) + fKeeper, ctx := keepertest.FinalityKeeper(t, bsKeeper, nil, cKeeper) + ms := keeper.NewMsgServerImpl(*fKeeper) + + // create and register a random finality provider + btcSK, btcPK, err := datagen.GenRandomBTCKeyPair(r) + require.NoError(t, err) + fp, err := datagen.GenRandomFinalityProviderWithBTCSK(r, btcSK) + require.NoError(t, err) + fpBTCPK := bbn.NewBIP340PubKeyFromBTCPK(btcPK) + fpBTCPKBytes := fpBTCPK.MustMarshal() + require.NoError(t, err) + + // set fp to be jailed + fp.Jailed = true + jailedTime := time.Now() + signingInfo := types.FinalityProviderSigningInfo{ + FpBtcPk: fpBTCPK, + } + err = fKeeper.FinalityProviderSigningTracker.Set(ctx, fpBTCPK.MustMarshal(), signingInfo) + require.NoError(t, err) + + // case 1: the signer's address does not match fp's address + signer := datagen.GenRandomAccount().Address + msg := &types.MsgUnjailFinalityProvider{ + Signer: signer, + FpBtcPk: fpBTCPK, + } + ctx = ctx.WithHeaderInfo(header.Info{Time: jailedTime.Add(1 * time.Second)}) + bsKeeper.EXPECT().GetFinalityProvider(gomock.Any(), fpBTCPKBytes).Return(fp, nil).AnyTimes() + _, err = ms.UnjailFinalityProvider(ctx, msg) + require.Equal(t, fmt.Sprintf("the fp's address %s does not match the signer %s of the requestion", + fp.Addr, msg.Signer), err.Error()) + + // case 2: unjail the fp when the jailing period is zero + msg.Signer = fp.Addr + _, err = ms.UnjailFinalityProvider(ctx, msg) + require.ErrorIs(t, err, bstypes.ErrFpNotJailed) + + // case 3: unjail the fp when the jailing period is not passed + msg.Signer = fp.Addr + signingInfo.JailedUntil = jailedTime + err = fKeeper.FinalityProviderSigningTracker.Set(ctx, fpBTCPK.MustMarshal(), signingInfo) + require.NoError(t, err) + ctx = ctx.WithHeaderInfo(header.Info{Time: jailedTime.Truncate(1 * time.Second)}) + _, err = ms.UnjailFinalityProvider(ctx, msg) + require.ErrorIs(t, err, types.ErrJailingPeriodNotPassed) + + // case 4: unjail the fp when the jailing period is passed + ctx = ctx.WithHeaderInfo(header.Info{Time: jailedTime.Add(1 * time.Second)}) + bsKeeper.EXPECT().UnjailFinalityProvider(ctx, fpBTCPKBytes).Return(nil).AnyTimes() + _, err = ms.UnjailFinalityProvider(ctx, msg) + require.NoError(t, err) }) } diff --git a/x/finality/types/errors.go b/x/finality/types/errors.go index 12a2966d8..d496d2b92 100644 --- a/x/finality/types/errors.go +++ b/x/finality/types/errors.go @@ -17,4 +17,5 @@ var ( ErrInvalidFinalitySig = errorsmod.Register(ModuleName, 1108, "finality signature is not valid") ErrNoSlashableEvidence = errorsmod.Register(ModuleName, 1109, "there is no slashable evidence") ErrPubRandCommitNotBTCTimestamped = errorsmod.Register(ModuleName, 1110, "the public randomness commit is not BTC timestamped yet") + ErrJailingPeriodNotPassed = errorsmod.Register(ModuleName, 1111, "the jailing period is not passed") ) diff --git a/x/finality/types/events.go b/x/finality/types/events.go index 6c6f400ca..b95d097e1 100644 --- a/x/finality/types/events.go +++ b/x/finality/types/events.go @@ -8,10 +8,6 @@ func NewEventSlashedFinalityProvider(evidence *Evidence) *EventSlashedFinalityPr } } -func NewEventSluggishFinalityProviderDetected(fpPk *types.BIP340PubKey) *EventSluggishFinalityProviderDetected { - return &EventSluggishFinalityProviderDetected{PublicKey: fpPk.MarshalHex()} -} - -func NewEventSluggishFinalityProviderReverted(fpPk *types.BIP340PubKey) *EventSluggishFinalityProviderReverted { - return &EventSluggishFinalityProviderReverted{PublicKey: fpPk.MarshalHex()} +func NewEventJailedFinalityProvider(fpPk *types.BIP340PubKey) *EventJailedFinalityProvider { + return &EventJailedFinalityProvider{PublicKey: fpPk.MarshalHex()} } diff --git a/x/finality/types/events.pb.go b/x/finality/types/events.pb.go index b6d9a35f6..945eb2c68 100644 --- a/x/finality/types/events.pb.go +++ b/x/finality/types/events.pb.go @@ -69,25 +69,25 @@ func (m *EventSlashedFinalityProvider) GetEvidence() *Evidence { return nil } -// EventSluggishFinalityProviderDetected is the event emitted when a finality provider is -// detected as sluggish -type EventSluggishFinalityProviderDetected struct { +// EventJailedFinalityProvider is the event emitted when a finality provider is +// jailed due to inactivity +type EventJailedFinalityProvider struct { // public_key is the BTC public key of the finality provider PublicKey string `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` } -func (m *EventSluggishFinalityProviderDetected) Reset() { *m = EventSluggishFinalityProviderDetected{} } -func (m *EventSluggishFinalityProviderDetected) String() string { return proto.CompactTextString(m) } -func (*EventSluggishFinalityProviderDetected) ProtoMessage() {} -func (*EventSluggishFinalityProviderDetected) Descriptor() ([]byte, []int) { +func (m *EventJailedFinalityProvider) Reset() { *m = EventJailedFinalityProvider{} } +func (m *EventJailedFinalityProvider) String() string { return proto.CompactTextString(m) } +func (*EventJailedFinalityProvider) ProtoMessage() {} +func (*EventJailedFinalityProvider) Descriptor() ([]byte, []int) { return fileDescriptor_c34c03aae5e3e6bf, []int{1} } -func (m *EventSluggishFinalityProviderDetected) XXX_Unmarshal(b []byte) error { +func (m *EventJailedFinalityProvider) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventSluggishFinalityProviderDetected) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventJailedFinalityProvider) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventSluggishFinalityProviderDetected.Marshal(b, m, deterministic) + return xxx_messageInfo_EventJailedFinalityProvider.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -97,66 +97,19 @@ func (m *EventSluggishFinalityProviderDetected) XXX_Marshal(b []byte, determinis return b[:n], nil } } -func (m *EventSluggishFinalityProviderDetected) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventSluggishFinalityProviderDetected.Merge(m, src) +func (m *EventJailedFinalityProvider) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventJailedFinalityProvider.Merge(m, src) } -func (m *EventSluggishFinalityProviderDetected) XXX_Size() int { +func (m *EventJailedFinalityProvider) XXX_Size() int { return m.Size() } -func (m *EventSluggishFinalityProviderDetected) XXX_DiscardUnknown() { - xxx_messageInfo_EventSluggishFinalityProviderDetected.DiscardUnknown(m) +func (m *EventJailedFinalityProvider) XXX_DiscardUnknown() { + xxx_messageInfo_EventJailedFinalityProvider.DiscardUnknown(m) } -var xxx_messageInfo_EventSluggishFinalityProviderDetected proto.InternalMessageInfo +var xxx_messageInfo_EventJailedFinalityProvider proto.InternalMessageInfo -func (m *EventSluggishFinalityProviderDetected) GetPublicKey() string { - if m != nil { - return m.PublicKey - } - return "" -} - -// EventSluggishFinalityProviderReverted is the event emitted when a sluggish finality -// provider is no longer considered sluggish -type EventSluggishFinalityProviderReverted struct { - // public_key is the BTC public key of the finality provider - PublicKey string `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` -} - -func (m *EventSluggishFinalityProviderReverted) Reset() { *m = EventSluggishFinalityProviderReverted{} } -func (m *EventSluggishFinalityProviderReverted) String() string { return proto.CompactTextString(m) } -func (*EventSluggishFinalityProviderReverted) ProtoMessage() {} -func (*EventSluggishFinalityProviderReverted) Descriptor() ([]byte, []int) { - return fileDescriptor_c34c03aae5e3e6bf, []int{2} -} -func (m *EventSluggishFinalityProviderReverted) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventSluggishFinalityProviderReverted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventSluggishFinalityProviderReverted.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 *EventSluggishFinalityProviderReverted) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventSluggishFinalityProviderReverted.Merge(m, src) -} -func (m *EventSluggishFinalityProviderReverted) XXX_Size() int { - return m.Size() -} -func (m *EventSluggishFinalityProviderReverted) XXX_DiscardUnknown() { - xxx_messageInfo_EventSluggishFinalityProviderReverted.DiscardUnknown(m) -} - -var xxx_messageInfo_EventSluggishFinalityProviderReverted proto.InternalMessageInfo - -func (m *EventSluggishFinalityProviderReverted) GetPublicKey() string { +func (m *EventJailedFinalityProvider) GetPublicKey() string { if m != nil { return m.PublicKey } @@ -165,14 +118,13 @@ func (m *EventSluggishFinalityProviderReverted) GetPublicKey() string { func init() { proto.RegisterType((*EventSlashedFinalityProvider)(nil), "babylon.finality.v1.EventSlashedFinalityProvider") - proto.RegisterType((*EventSluggishFinalityProviderDetected)(nil), "babylon.finality.v1.EventSluggishFinalityProviderDetected") - proto.RegisterType((*EventSluggishFinalityProviderReverted)(nil), "babylon.finality.v1.EventSluggishFinalityProviderReverted") + proto.RegisterType((*EventJailedFinalityProvider)(nil), "babylon.finality.v1.EventJailedFinalityProvider") } func init() { proto.RegisterFile("babylon/finality/v1/events.proto", fileDescriptor_c34c03aae5e3e6bf) } var fileDescriptor_c34c03aae5e3e6bf = []byte{ - // 252 bytes of a gzipped FileDescriptorProto + // 231 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0xcb, 0xcc, 0x4b, 0xcc, 0xc9, 0x2c, 0xa9, 0xd4, 0x2f, 0x33, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xaa, @@ -180,15 +132,14 @@ var fileDescriptor_c34c03aae5e3e6bf = []byte{ 0x92, 0x4b, 0xc6, 0x15, 0x64, 0x50, 0x70, 0x4e, 0x62, 0x71, 0x46, 0x6a, 0x8a, 0x1b, 0x54, 0x36, 0xa0, 0x28, 0xbf, 0x2c, 0x33, 0x25, 0xb5, 0x48, 0xc8, 0x92, 0x8b, 0x23, 0x15, 0xc4, 0xca, 0x4b, 0x4e, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd5, 0xc3, 0x62, 0x97, 0x9e, 0x2b, 0x54, - 0x51, 0x10, 0x5c, 0xb9, 0x92, 0x1b, 0x97, 0x2a, 0xd4, 0xe8, 0xd2, 0xf4, 0xf4, 0xcc, 0xe2, 0x0c, - 0x74, 0xb3, 0x5d, 0x52, 0x4b, 0x52, 0x93, 0x4b, 0x52, 0x53, 0x84, 0x64, 0xb9, 0xb8, 0x0a, 0x4a, - 0x93, 0x72, 0x32, 0x93, 0xe3, 0xb3, 0x53, 0x2b, 0xc1, 0xb6, 0x70, 0x06, 0x71, 0x42, 0x44, 0xbc, - 0x53, 0x2b, 0x09, 0x9a, 0x13, 0x94, 0x5a, 0x96, 0x5a, 0x44, 0xd8, 0x1c, 0x27, 0x9f, 0x13, 0x8f, - 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, - 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4a, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, - 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0x7a, 0x2e, 0x27, 0x31, 0xa9, 0x58, 0x37, 0x33, 0x1f, 0xc6, 0xd5, - 0xaf, 0x40, 0x04, 0x62, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0xfc, 0x8c, 0x01, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x58, 0x3c, 0x4f, 0x58, 0x9c, 0x01, 0x00, 0x00, + 0x51, 0x10, 0x5c, 0xb9, 0x92, 0x0d, 0x97, 0x34, 0xd8, 0x68, 0xaf, 0xc4, 0xcc, 0x1c, 0x2c, 0x26, + 0xcb, 0x72, 0x71, 0x15, 0x94, 0x26, 0xe5, 0x64, 0x26, 0xc7, 0x67, 0xa7, 0x56, 0x82, 0xcd, 0xe6, + 0x0c, 0xe2, 0x84, 0x88, 0x78, 0xa7, 0x56, 0x3a, 0xf9, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, + 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, + 0xb1, 0x1c, 0x43, 0x94, 0x51, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, + 0xd4, 0x29, 0x39, 0x89, 0x49, 0xc5, 0xba, 0x99, 0xf9, 0x30, 0xae, 0x7e, 0x05, 0xc2, 0xcb, 0x25, + 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xdf, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf0, + 0x48, 0xe5, 0x2e, 0x4a, 0x01, 0x00, 0x00, } func (m *EventSlashedFinalityProvider) Marshal() (dAtA []byte, err error) { @@ -226,37 +177,7 @@ func (m *EventSlashedFinalityProvider) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *EventSluggishFinalityProviderDetected) 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 *EventSluggishFinalityProviderDetected) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventSluggishFinalityProviderDetected) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PublicKey) > 0 { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintEvents(dAtA, i, uint64(len(m.PublicKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventSluggishFinalityProviderReverted) Marshal() (dAtA []byte, err error) { +func (m *EventJailedFinalityProvider) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -266,12 +187,12 @@ func (m *EventSluggishFinalityProviderReverted) Marshal() (dAtA []byte, err erro return dAtA[:n], nil } -func (m *EventSluggishFinalityProviderReverted) MarshalTo(dAtA []byte) (int, error) { +func (m *EventJailedFinalityProvider) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventSluggishFinalityProviderReverted) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventJailedFinalityProvider) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -310,20 +231,7 @@ func (m *EventSlashedFinalityProvider) Size() (n int) { return n } -func (m *EventSluggishFinalityProviderDetected) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) - } - return n -} - -func (m *EventSluggishFinalityProviderReverted) Size() (n int) { +func (m *EventJailedFinalityProvider) Size() (n int) { if m == nil { return 0 } @@ -428,89 +336,7 @@ func (m *EventSlashedFinalityProvider) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventSluggishFinalityProviderDetected) 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 ErrIntOverflowEvents - } - 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: EventSluggishFinalityProviderDetected: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventSluggishFinalityProviderDetected: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - 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 ErrInvalidLengthEvents - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvents - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvents(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvents - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventSluggishFinalityProviderReverted) Unmarshal(dAtA []byte) error { +func (m *EventJailedFinalityProvider) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -533,10 +359,10 @@ func (m *EventSluggishFinalityProviderReverted) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventSluggishFinalityProviderReverted: wiretype end group for non-group") + return fmt.Errorf("proto: EventJailedFinalityProvider: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventSluggishFinalityProviderReverted: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventJailedFinalityProvider: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/finality/types/expected_keepers.go b/x/finality/types/expected_keepers.go index b05dd2cff..85b0f9e0b 100644 --- a/x/finality/types/expected_keepers.go +++ b/x/finality/types/expected_keepers.go @@ -19,7 +19,7 @@ type BTCStakingKeeper interface { GetBTCStakingActivatedHeight(ctx context.Context) (uint64, error) GetVotingPowerDistCache(ctx context.Context, height uint64) (*bstypes.VotingPowerDistCache, error) RemoveVotingPowerDistCache(ctx context.Context, height uint64) - RevertSluggishFinalityProvider(ctx context.Context, fpBTCPK []byte) error + UnjailFinalityProvider(ctx context.Context, fpBTCPK []byte) error } type CheckpointingKeeper interface { diff --git a/x/finality/types/finality.pb.go b/x/finality/types/finality.pb.go index 0b1804fbf..93c60cba2 100644 --- a/x/finality/types/finality.pb.go +++ b/x/finality/types/finality.pb.go @@ -6,17 +6,22 @@ package types import ( fmt "fmt" github_com_babylonlabs_io_babylon_types "github.com/babylonlabs-io/babylon/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -252,6 +257,8 @@ type FinalityProviderSigningInfo struct { // missed_blocks_counter defines a counter to avoid unnecessary array reads. // Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. MissedBlocksCounter int64 `protobuf:"varint,3,opt,name=missed_blocks_counter,json=missedBlocksCounter,proto3" json:"missed_blocks_counter,omitempty"` + // Timestamp until which the validator is jailed due to liveness downtime. + JailedUntil time.Time `protobuf:"bytes,4,opt,name=jailed_until,json=jailedUntil,proto3,stdtime" json:"jailed_until"` } func (m *FinalityProviderSigningInfo) Reset() { *m = FinalityProviderSigningInfo{} } @@ -301,6 +308,13 @@ func (m *FinalityProviderSigningInfo) GetMissedBlocksCounter() int64 { return 0 } +func (m *FinalityProviderSigningInfo) GetJailedUntil() time.Time { + if m != nil { + return m.JailedUntil + } + return time.Time{} +} + func init() { proto.RegisterType((*IndexedBlock)(nil), "babylon.finality.v1.IndexedBlock") proto.RegisterType((*PubRandCommit)(nil), "babylon.finality.v1.PubRandCommit") @@ -313,43 +327,48 @@ func init() { } var fileDescriptor_ca5b87e52e3e6d02 = []byte{ - // 561 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0x49, 0xc8, 0xc7, 0xc6, 0x15, 0xe0, 0x96, 0x2a, 0x50, 0xe4, 0x06, 0x9f, 0x72, 0x80, - 0x84, 0x7e, 0x08, 0x21, 0x6e, 0xb8, 0x2a, 0x6a, 0x04, 0x82, 0xc8, 0x29, 0x17, 0x2e, 0xab, 0xf5, - 0x7a, 0x6d, 0xaf, 0x12, 0xef, 0xae, 0xec, 0x75, 0xd4, 0xf0, 0x03, 0x38, 0xc3, 0xbf, 0x42, 0x9c, - 0x7a, 0x44, 0x3d, 0x54, 0x28, 0xf9, 0x23, 0xc8, 0x6b, 0xc7, 0x69, 0x4e, 0x20, 0x10, 0x37, 0xef, - 0x9b, 0xf1, 0xbc, 0x79, 0xb3, 0x6f, 0x16, 0x58, 0x2e, 0x72, 0xe7, 0x53, 0xce, 0x06, 0x3e, 0x65, - 0x68, 0x4a, 0xe5, 0x7c, 0x30, 0x3b, 0x28, 0xbf, 0xfb, 0x22, 0xe6, 0x92, 0x1b, 0xdb, 0x45, 0x4e, - 0xbf, 0xc4, 0x67, 0x07, 0x0f, 0x77, 0x02, 0x1e, 0x70, 0x15, 0x1f, 0x64, 0x5f, 0x79, 0xaa, 0x05, - 0x81, 0x3e, 0x64, 0x1e, 0xb9, 0x20, 0x9e, 0x3d, 0xe5, 0x78, 0x62, 0xec, 0x82, 0x7a, 0x48, 0x68, - 0x10, 0xca, 0x8e, 0xd6, 0xd5, 0x7a, 0x35, 0xa7, 0x38, 0x19, 0x0f, 0x40, 0x13, 0x09, 0x01, 0x43, - 0x94, 0x84, 0x9d, 0x5b, 0x5d, 0xad, 0xa7, 0x3b, 0x0d, 0x24, 0xc4, 0x19, 0x4a, 0x42, 0xe3, 0x11, - 0x68, 0xe5, 0x3c, 0x9f, 0x88, 0xd7, 0xa9, 0x76, 0xb5, 0x5e, 0xd3, 0x59, 0x03, 0xd6, 0x57, 0x0d, - 0x6c, 0x8d, 0x52, 0xd7, 0x41, 0xcc, 0x3b, 0xe1, 0x51, 0x44, 0xa5, 0xf1, 0x18, 0xe8, 0x89, 0x44, - 0xb1, 0x84, 0x1b, 0x44, 0x6d, 0x85, 0x9d, 0xe5, 0x6c, 0x5d, 0xa0, 0xb3, 0x34, 0x82, 0x22, 0x75, - 0x61, 0x8c, 0x98, 0xa7, 0x18, 0x6b, 0x0e, 0x60, 0x69, 0x54, 0x94, 0x32, 0x4c, 0x00, 0xb0, 0x2a, - 0x17, 0x11, 0x26, 0x15, 0xab, 0xee, 0xdc, 0x40, 0x8c, 0x3d, 0xd0, 0x22, 0x82, 0xe3, 0x10, 0xb2, - 0x34, 0xea, 0xd4, 0xd4, 0xef, 0x4d, 0x05, 0xbc, 0x4b, 0x23, 0xeb, 0x73, 0x0d, 0x34, 0x4f, 0x67, - 0xd4, 0x23, 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xd5, 0x79, 0x14, 0xf3, 0xcc, 0x12, 0xf1, 0x98, - 0x06, 0x8c, 0xb2, 0x60, 0xc8, 0x7c, 0xfe, 0xff, 0xbc, 0xb1, 0xb1, 0x00, 0x99, 0x37, 0xaa, 0x9b, - 0x0b, 0x70, 0x08, 0xee, 0x47, 0x34, 0x49, 0x88, 0x07, 0x95, 0x63, 0x12, 0x88, 0x79, 0xca, 0x24, - 0x89, 0x95, 0x51, 0xaa, 0xce, 0x76, 0x1e, 0x54, 0x2b, 0x9b, 0x9c, 0xe4, 0x21, 0xfb, 0xed, 0xb7, - 0x85, 0xa9, 0x5d, 0x2e, 0x4c, 0xed, 0xe7, 0xc2, 0xd4, 0xbe, 0x2c, 0xcd, 0xca, 0xe5, 0xd2, 0xac, - 0xfc, 0x58, 0x9a, 0x95, 0x8f, 0x87, 0xbf, 0xef, 0xf7, 0x62, 0xfd, 0x9e, 0xa8, 0xd6, 0xdd, 0xba, - 0x7a, 0x1f, 0x8e, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xa1, 0x77, 0x79, 0x70, 0x04, 0x00, - 0x00, + // 646 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0x8e, 0xdb, 0xfc, 0x9a, 0x74, 0xe3, 0xea, 0x47, 0xdd, 0x52, 0x85, 0x16, 0x39, 0x21, 0xa7, + 0x0a, 0x81, 0x4d, 0xff, 0x08, 0x21, 0x6e, 0xb8, 0x2a, 0x6a, 0x45, 0x05, 0x91, 0xd3, 0x5e, 0xb8, + 0xac, 0xd6, 0xf6, 0xda, 0x5e, 0x62, 0xef, 0xae, 0xec, 0x75, 0xd5, 0xf0, 0x00, 0x9c, 0xcb, 0x8d, + 0x47, 0xe0, 0xc8, 0x63, 0xf4, 0xd8, 0x23, 0xea, 0xa1, 0xa0, 0xe6, 0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, + 0x8d, 0x26, 0x0b, 0xe1, 0x2c, 0x48, 0xf6, 0x9d, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xae, + 0x27, 0x1f, 0xf2, 0x04, 0x00, 0x00, } func (m *IndexedBlock) Marshal() (dAtA []byte, err error) { @@ -552,6 +571,14 @@ func (m *FinalityProviderSigningInfo) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.JailedUntil, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.JailedUntil):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintFinality(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x22 if m.MissedBlocksCounter != 0 { i = encodeVarintFinality(dAtA, i, uint64(m.MissedBlocksCounter)) i-- @@ -681,6 +708,8 @@ func (m *FinalityProviderSigningInfo) Size() (n int) { if m.MissedBlocksCounter != 0 { n += 1 + sovFinality(uint64(m.MissedBlocksCounter)) } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.JailedUntil) + n += 1 + l + sovFinality(uint64(l)) return n } @@ -1333,6 +1362,39 @@ func (m *FinalityProviderSigningInfo) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JailedUntil", 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 + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.JailedUntil, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipFinality(dAtA[iNdEx:]) diff --git a/x/finality/types/keys.go b/x/finality/types/keys.go index 055de21d4..96b9fc331 100644 --- a/x/finality/types/keys.go +++ b/x/finality/types/keys.go @@ -2,9 +2,6 @@ package types import ( "cosmossdk.io/collections" - "github.com/cosmos/cosmos-sdk/types/address" - - "github.com/babylonlabs-io/babylon/types" ) const ( @@ -51,13 +48,3 @@ var ( FinalityProviderSigningInfoKeyPrefix = collections.NewPrefix(8) // key prefix for signing info FinalityProviderMissedBlockBitmapKeyPrefix = collections.NewPrefix(9) // key prefix for missed block bitmap ) - -// FinalityProviderSigningInfoKey - stored by finality provider public key in BIP340 -func FinalityProviderSigningInfoKey(pk *types.BIP340PubKey) []byte { - return append(FinalityProviderSigningInfoKeyPrefix, address.MustLengthPrefix(pk.MustMarshal())...) -} - -// FinalityProviderMissedBlockBitmapKey - stored by finality provider public key in BIP340 -func FinalityProviderMissedBlockBitmapKey(pk *types.BIP340PubKey) []byte { - return append(FinalityProviderMissedBlockBitmapKeyPrefix, address.MustLengthPrefix(pk.MustMarshal())...) -} diff --git a/x/finality/types/metrics.go b/x/finality/types/metrics.go index 2c8d89ae2..6e6dbeee9 100644 --- a/x/finality/types/metrics.go +++ b/x/finality/types/metrics.go @@ -7,8 +7,9 @@ import ( // performance oriented metrics measuring the execution time of each message const ( - MetricsKeyCommitPubRandList = "commit_pub_rand_list" - MetricsKeyAddFinalitySig = "add_finality_sig" + MetricsKeyCommitPubRandList = "commit_pub_rand_list" + MetricsKeyAddFinalitySig = "add_finality_sig" + MetricsKeyUnjailFinalityProvider = "unjail_finality_provider" ) const ( @@ -23,9 +24,9 @@ const ( /* Metrics for monitoring finality provider liveness */ - // MetricsKeySluggishFinalityProviderCounter is the number of finality providers - // that are being labeled as sluggish - MetricsKeySluggishFinalityProviderCounter = "sluggish_finality_provider_counter" + // MetricsKeyJailedFinalityProviderCounter is the number of finality providers + // that are being labeled as jailed + MetricsKeyJailedFinalityProviderCounter = "jailed_finality_provider_counter" ) // RecordLastHeight records the last height. It is triggered upon `IndexBlock` @@ -51,10 +52,10 @@ func RecordLastFinalizedHeight(height uint64) { ) } -// IncrementSluggishFinalityProviderCounter increments the counter for the sluggish +// IncrementJailedFinalityProviderCounter increments the counter for the jailed // finality providers -func IncrementSluggishFinalityProviderCounter() { - keys := []string{MetricsKeySluggishFinalityProviderCounter} +func IncrementJailedFinalityProviderCounter() { + keys := []string{MetricsKeyJailedFinalityProviderCounter} labels := []metrics.Label{telemetry.NewLabel(telemetry.MetricLabelNameModule, ModuleName)} telemetry.IncrCounterWithLabels( keys, @@ -63,10 +64,10 @@ func IncrementSluggishFinalityProviderCounter() { ) } -// DecrementSluggishFinalityProviderCounter increments the counter for the sluggish +// DecrementJailedFinalityProviderCounter decrements the counter for the jailed // finality providers -func DecrementSluggishFinalityProviderCounter() { - keys := []string{MetricsKeySluggishFinalityProviderCounter} +func DecrementJailedFinalityProviderCounter() { + keys := []string{MetricsKeyJailedFinalityProviderCounter} labels := []metrics.Label{telemetry.NewLabel(telemetry.MetricLabelNameModule, ModuleName)} telemetry.IncrCounterWithLabels( keys, diff --git a/x/finality/types/mocked_keepers.go b/x/finality/types/mocked_keepers.go index cdd2ee210..c394199f4 100644 --- a/x/finality/types/mocked_keepers.go +++ b/x/finality/types/mocked_keepers.go @@ -164,32 +164,32 @@ func (mr *MockBTCStakingKeeperMockRecorder) RemoveVotingPowerDistCache(ctx, heig return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveVotingPowerDistCache", reflect.TypeOf((*MockBTCStakingKeeper)(nil).RemoveVotingPowerDistCache), ctx, height) } -// RevertSluggishFinalityProvider mocks base method. -func (m *MockBTCStakingKeeper) RevertSluggishFinalityProvider(ctx context.Context, fpBTCPK []byte) error { +// SlashFinalityProvider mocks base method. +func (m *MockBTCStakingKeeper) SlashFinalityProvider(ctx context.Context, fpBTCPK []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RevertSluggishFinalityProvider", ctx, fpBTCPK) + ret := m.ctrl.Call(m, "SlashFinalityProvider", ctx, fpBTCPK) ret0, _ := ret[0].(error) return ret0 } -// RevertSluggishFinalityProvider indicates an expected call of RevertSluggishFinalityProvider. -func (mr *MockBTCStakingKeeperMockRecorder) RevertSluggishFinalityProvider(ctx, fpBTCPK interface{}) *gomock.Call { +// SlashFinalityProvider indicates an expected call of SlashFinalityProvider. +func (mr *MockBTCStakingKeeperMockRecorder) SlashFinalityProvider(ctx, fpBTCPK interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevertSluggishFinalityProvider", reflect.TypeOf((*MockBTCStakingKeeper)(nil).RevertSluggishFinalityProvider), ctx, fpBTCPK) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashFinalityProvider", reflect.TypeOf((*MockBTCStakingKeeper)(nil).SlashFinalityProvider), ctx, fpBTCPK) } -// SlashFinalityProvider mocks base method. -func (m *MockBTCStakingKeeper) SlashFinalityProvider(ctx context.Context, fpBTCPK []byte) error { +// UnjailFinalityProvider mocks base method. +func (m *MockBTCStakingKeeper) UnjailFinalityProvider(ctx context.Context, fpBTCPK []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SlashFinalityProvider", ctx, fpBTCPK) + ret := m.ctrl.Call(m, "UnjailFinalityProvider", ctx, fpBTCPK) ret0, _ := ret[0].(error) return ret0 } -// SlashFinalityProvider indicates an expected call of SlashFinalityProvider. -func (mr *MockBTCStakingKeeperMockRecorder) SlashFinalityProvider(ctx, fpBTCPK interface{}) *gomock.Call { +// UnjailFinalityProvider indicates an expected call of UnjailFinalityProvider. +func (mr *MockBTCStakingKeeperMockRecorder) UnjailFinalityProvider(ctx, fpBTCPK interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashFinalityProvider", reflect.TypeOf((*MockBTCStakingKeeper)(nil).SlashFinalityProvider), ctx, fpBTCPK) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnjailFinalityProvider", reflect.TypeOf((*MockBTCStakingKeeper)(nil).UnjailFinalityProvider), ctx, fpBTCPK) } // MockCheckpointingKeeper is a mock of CheckpointingKeeper interface. diff --git a/x/finality/types/params.go b/x/finality/types/params.go index a936e17a5..1bf540a06 100644 --- a/x/finality/types/params.go +++ b/x/finality/types/params.go @@ -2,6 +2,7 @@ package types import ( "fmt" + "time" "cosmossdk.io/math" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -13,6 +14,7 @@ const ( DefaultSignedBlocksWindow = int64(100) DefaultMinPubRand = 100 DefaultFinalitySigTimeout = 3 + DefaultJailDuration = 24 * 60 * 60 * 1 * time.Second // 1 day ) var ( @@ -28,6 +30,7 @@ func DefaultParams() Params { SignedBlocksWindow: DefaultSignedBlocksWindow, MinSignedPerWindow: DefaultMinSignedPerWindow, MinPubRand: DefaultMinPubRand, + JailDuration: DefaultJailDuration, } } diff --git a/x/finality/types/params.pb.go b/x/finality/types/params.pb.go index cec13955b..1fe6ea1a4 100644 --- a/x/finality/types/params.pb.go +++ b/x/finality/types/params.pb.go @@ -10,15 +10,19 @@ import ( _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -34,11 +38,13 @@ type Params struct { // vote before being judged as missing their voting turn on the given block FinalitySigTimeout int64 `protobuf:"varint,2,opt,name=finality_sig_timeout,json=finalitySigTimeout,proto3" json:"finality_sig_timeout,omitempty"` // min_signed_per_window defines the minimum number of blocks that a finality provider is required to sign - // within the sliding window to avoid being detected as sluggish + // within the sliding window to avoid being jailed MinSignedPerWindow cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=min_signed_per_window,json=minSignedPerWindow,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_signed_per_window"` // min_pub_rand is the minimum number of public randomness each // message should commit MinPubRand uint64 `protobuf:"varint,4,opt,name=min_pub_rand,json=minPubRand,proto3" json:"min_pub_rand,omitempty"` + // jail_duration is the minimum period of time that a finality provider remains jailed + JailDuration time.Duration `protobuf:"bytes,5,opt,name=jail_duration,json=jailDuration,proto3,stdduration" json:"jail_duration"` } func (m *Params) Reset() { *m = Params{} } @@ -94,6 +100,13 @@ func (m *Params) GetMinPubRand() uint64 { return 0 } +func (m *Params) GetJailDuration() time.Duration { + if m != nil { + return m.JailDuration + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "babylon.finality.v1.Params") } @@ -101,30 +114,34 @@ func init() { func init() { proto.RegisterFile("babylon/finality/v1/params.proto", fileDescriptor_25539c9a61c72ee9) } var fileDescriptor_25539c9a61c72ee9 = []byte{ - // 361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x91, 0x31, 0x6b, 0xe3, 0x30, - 0x14, 0xc7, 0xad, 0x4b, 0xc8, 0x60, 0xb2, 0x9c, 0x2f, 0x07, 0xb9, 0x1c, 0x38, 0xe6, 0xa6, 0x70, - 0x10, 0xab, 0x69, 0xa1, 0x43, 0xc7, 0x90, 0x31, 0x43, 0x70, 0x0a, 0x85, 0x2e, 0x46, 0xb2, 0x55, - 0xe7, 0x11, 0x4b, 0x32, 0x96, 0x9d, 0xd4, 0xdf, 0xa2, 0x63, 0xc7, 0x8e, 0x1d, 0x3b, 0xf4, 0x43, - 0x64, 0x0c, 0x9d, 0x4a, 0x87, 0x50, 0x92, 0xa1, 0x1f, 0xa3, 0x25, 0x96, 0x4d, 0x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 0x0e, 0x62, 0x5e, 0xde, 0x39, 0x63, 0x69, 0x15, 0xce, 0x31, 0xdb, 0x47, 0xab, - 0x24, 0xa7, 0x7e, 0x4a, 0x44, 0xd8, 0x6d, 0x3a, 0x68, 0xd0, 0xf4, 0x4c, 0x0e, 0x62, 0x96, 0x53, - 0x8f, 0x88, 0xf0, 0xa2, 0x79, 0xff, 0xd0, 0x37, 0xc6, 0xd3, 0xcd, 0xde, 0x46, 0xdb, 0xbd, 0x8d, - 0xde, 0xf7, 0x36, 0xba, 0x3b, 0xd8, 0xc6, 0xf6, 0x60, 0x1b, 0xaf, 0x07, 0xdb, 0xb8, 0x3e, 0x8d, - 0x20, 0x5b, 0xe4, 0xd4, 0x0d, 0x24, 0xc7, 0xd5, 0xfc, 0x63, 0x42, 0xd5, 0x10, 0x64, 0x5d, 0xe2, - 0xdb, 0xef, 0x2f, 0xcb, 0x8a, 0x84, 0x29, 0xda, 0x2a, 0xc7, 0x7a, 0xf6, 0x15, 0x00, 0x00, 0xff, - 0xff, 0xda, 0x3a, 0x9d, 0x97, 0xd3, 0x01, 0x00, 0x00, + // 420 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x92, 0x31, 0x6f, 0xd4, 0x30, + 0x14, 0xc7, 0xe3, 0xf6, 0xe8, 0x10, 0xae, 0x03, 0xa1, 0x48, 0xd7, 0x22, 0xe5, 0x22, 0xa6, 0x13, + 0x52, 0x6d, 0x5a, 0x24, 0x06, 0xc6, 0xd3, 0x8d, 0x45, 0x3a, 0x5d, 0x91, 0x90, 0x58, 0x22, 0x3b, + 0x71, 0xdd, 0x47, 0x63, 0xbf, 0x28, 0x4e, 0x5a, 0xf2, 0x2d, 0x18, 0x3b, 0x32, 0x32, 0x32, 0xf0, + 0x21, 0x3a, 0xa1, 0x8a, 0x09, 0x31, 0x1c, 0xe8, 0x6e, 0xe0, 0x6b, 0xa0, 0xc4, 0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x15, 0xcf, 0xda, 0x85, 0xcc, 0x7e, 0x7c, 0x3b, 0x0e, 0x87, 0x11, 0x17, 0x32, 0xfb, + 0xf2, 0xf7, 0xeb, 0x73, 0xb2, 0x8a, 0x34, 0x98, 0xf3, 0xfe, 0x9f, 0x4b, 0x59, 0x0d, 0xe1, 0x92, + 0x70, 0xdc, 0x59, 0x95, 0x8d, 0x48, 0x2b, 0x6e, 0xf2, 0xc9, 0x28, 0x21, 0xb3, 0xd1, 0x2a, 0xd4, + 0x60, 0x96, 0x8d, 0x58, 0x71, 0x93, 0x47, 0x6f, 0xc2, 0xfd, 0x0f, 0x1c, 0x8a, 0xd4, 0xaf, 0x64, + 0xf2, 0x20, 0x21, 0xb3, 0x87, 0xa7, 0x87, 0xd4, 0xed, 0x8c, 0xfa, 0x9d, 0xd1, 0xc5, 0x20, 0x98, + 0xef, 0x77, 0xf9, 0x6e, 0x7f, 0x4f, 0x89, 0xb3, 0x1d, 0x77, 0xed, 0x1e, 0xbe, 0x1e, 0xdd, 0x7e, + 0x9e, 0x06, 0xf3, 0xb3, 0xbb, 0x4d, 0x4c, 0xee, 0x37, 0x31, 0xf9, 0xb3, 0x89, 0xc9, 0xa7, 0x6d, + 0x1c, 0xdc, 0x6f, 0xe3, 0xe0, 0xe7, 0x36, 0x0e, 0xde, 0x9f, 0x2a, 0xa8, 0x2f, 0x1b, 0x41, 0x33, + 0xd4, 0x6c, 0x38, 0xee, 0x82, 0x0b, 0x7b, 0x0c, 0xe8, 0x4b, 0xf6, 0xf1, 0xff, 0x0d, 0xa9, 0xdb, + 0x52, 0x5a, 0xb1, 0xd7, 0x67, 0x78, 0xf9, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xd4, 0xa2, 0x2b, + 0x42, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -147,6 +164,14 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.JailDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.JailDuration):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintParams(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x2a if m.MinPubRand != 0 { i = encodeVarintParams(dAtA, i, uint64(m.MinPubRand)) i-- @@ -203,6 +228,8 @@ func (m *Params) Size() (n int) { if m.MinPubRand != 0 { n += 1 + sovParams(uint64(m.MinPubRand)) } + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.JailDuration) + n += 1 + l + sovParams(uint64(l)) return n } @@ -331,6 +358,39 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JailDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.JailDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/finality/types/signing_info.go b/x/finality/types/signing_info.go index 72cbe4cd1..47a49441e 100644 --- a/x/finality/types/signing_info.go +++ b/x/finality/types/signing_info.go @@ -1,7 +1,10 @@ package types import ( + "time" + bbntypes "github.com/babylonlabs-io/babylon/types" + bstypes "github.com/babylonlabs-io/babylon/x/btcstaking/types" ) // NewFinalityProviderSigningInfo creates a new FinalityProviderSigningInfo instance @@ -15,6 +18,14 @@ func NewFinalityProviderSigningInfo( } } +func (si *FinalityProviderSigningInfo) IsJailingPeriodPassed(curBlockTime time.Time) (bool, error) { + if si.JailedUntil.IsZero() { + return false, bstypes.ErrFpNotJailed + } + + return si.JailedUntil.Before(curBlockTime), nil +} + func (si *FinalityProviderSigningInfo) IncrementMissedBlocksCounter() { si.MissedBlocksCounter++ } diff --git a/x/finality/types/tx.pb.go b/x/finality/types/tx.pb.go index a4768d48e..835433de4 100644 --- a/x/finality/types/tx.pb.go +++ b/x/finality/types/tx.pb.go @@ -365,6 +365,83 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgUnjailFinalityProvider defines the Msg/UnjailFinalityProvider request type +type MsgUnjailFinalityProvider struct { + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + // fp_btc_pk is the BTC PK of the finality provider that commits the public randomness + FpBtcPk *github_com_babylonlabs_io_babylon_types.BIP340PubKey `protobuf:"bytes,2,opt,name=fp_btc_pk,json=fpBtcPk,proto3,customtype=github.com/babylonlabs-io/babylon/types.BIP340PubKey" json:"fp_btc_pk,omitempty"` +} + +func (m *MsgUnjailFinalityProvider) Reset() { *m = MsgUnjailFinalityProvider{} } +func (m *MsgUnjailFinalityProvider) String() string { return proto.CompactTextString(m) } +func (*MsgUnjailFinalityProvider) ProtoMessage() {} +func (*MsgUnjailFinalityProvider) Descriptor() ([]byte, []int) { + return fileDescriptor_2dd6da066b6baf1d, []int{6} +} +func (m *MsgUnjailFinalityProvider) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnjailFinalityProvider) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnjailFinalityProvider.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 *MsgUnjailFinalityProvider) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnjailFinalityProvider.Merge(m, src) +} +func (m *MsgUnjailFinalityProvider) XXX_Size() int { + return m.Size() +} +func (m *MsgUnjailFinalityProvider) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnjailFinalityProvider.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnjailFinalityProvider proto.InternalMessageInfo + +// MsgUnjailFinalityProviderResponse defines the Msg/UnjailFinalityProvider response type +type MsgUnjailFinalityProviderResponse struct { +} + +func (m *MsgUnjailFinalityProviderResponse) Reset() { *m = MsgUnjailFinalityProviderResponse{} } +func (m *MsgUnjailFinalityProviderResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUnjailFinalityProviderResponse) ProtoMessage() {} +func (*MsgUnjailFinalityProviderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2dd6da066b6baf1d, []int{7} +} +func (m *MsgUnjailFinalityProviderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnjailFinalityProviderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnjailFinalityProviderResponse.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 *MsgUnjailFinalityProviderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnjailFinalityProviderResponse.Merge(m, src) +} +func (m *MsgUnjailFinalityProviderResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUnjailFinalityProviderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnjailFinalityProviderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnjailFinalityProviderResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCommitPubRandList)(nil), "babylon.finality.v1.MsgCommitPubRandList") proto.RegisterType((*MsgCommitPubRandListResponse)(nil), "babylon.finality.v1.MsgCommitPubRandListResponse") @@ -372,57 +449,63 @@ func init() { proto.RegisterType((*MsgAddFinalitySigResponse)(nil), "babylon.finality.v1.MsgAddFinalitySigResponse") proto.RegisterType((*MsgUpdateParams)(nil), "babylon.finality.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "babylon.finality.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgUnjailFinalityProvider)(nil), "babylon.finality.v1.MsgUnjailFinalityProvider") + proto.RegisterType((*MsgUnjailFinalityProviderResponse)(nil), "babylon.finality.v1.MsgUnjailFinalityProviderResponse") } func init() { proto.RegisterFile("babylon/finality/v1/tx.proto", fileDescriptor_2dd6da066b6baf1d) } var fileDescriptor_2dd6da066b6baf1d = []byte{ - // 714 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x4f, 0x4f, 0x13, 0x4f, - 0x18, 0xee, 0x52, 0x28, 0x3f, 0xa6, 0x0d, 0xbf, 0xb0, 0x12, 0x59, 0x0a, 0x6e, 0x6b, 0x43, 0x0c, - 0x12, 0xd9, 0x95, 0x42, 0x50, 0xf1, 0x44, 0x8d, 0x06, 0x23, 0x8d, 0xcd, 0x16, 0x2e, 0x26, 0x66, - 0xb3, 0xff, 0x3a, 0x3b, 0xa1, 0xbb, 0x33, 0xce, 0xcc, 0x12, 0x7a, 0x33, 0x7e, 0x02, 0x0f, 0x7e, - 0x10, 0x0e, 0x5e, 0x3d, 0x9a, 0x70, 0x31, 0x21, 0x9e, 0x0c, 0x87, 0xc6, 0xc0, 0x81, 0xaf, 0x61, - 0xba, 0x3b, 0xa5, 0x14, 0x4a, 0xac, 0x1e, 0xbc, 0xed, 0xbc, 0xef, 0xf3, 0xce, 0xf3, 0xec, 0xfb, - 0xbc, 0xef, 0x80, 0x79, 0xdb, 0xb2, 0x5b, 0x4d, 0x1c, 0xea, 0x0d, 0x14, 0x5a, 0x4d, 0xc4, 0x5b, - 0xfa, 0xfe, 0x8a, 0xce, 0x0f, 0x34, 0x42, 0x31, 0xc7, 0xf2, 0x2d, 0x91, 0xd5, 0xba, 0x59, 0x6d, - 0x7f, 0x25, 0x3f, 0x0d, 0x31, 0xc4, 0x71, 0x5e, 0xef, 0x7c, 0x25, 0xd0, 0xfc, 0x1d, 0xee, 0x85, - 0xae, 0x47, 0x03, 0x14, 0x72, 0xdd, 0xa1, 0x2d, 0xc2, 0xb1, 0x4e, 0x28, 0xc6, 0x0d, 0x91, 0x9e, - 0x75, 0x30, 0x0b, 0x30, 0x33, 0x93, 0xba, 0xe4, 0x20, 0x52, 0x33, 0xc9, 0x49, 0x0f, 0x18, 0xec, - 0x90, 0x07, 0x0c, 0x8a, 0x44, 0x71, 0x90, 0x36, 0x62, 0x51, 0x2b, 0x10, 0xa5, 0xa5, 0xaf, 0x23, - 0x60, 0xba, 0xca, 0xe0, 0x33, 0x1c, 0x04, 0x88, 0xd7, 0x22, 0xdb, 0xb0, 0x42, 0x77, 0x1b, 0x31, - 0x2e, 0xdf, 0x06, 0x19, 0x86, 0x60, 0xe8, 0x51, 0x45, 0x2a, 0x4a, 0x8b, 0x13, 0x86, 0x38, 0xc9, - 0x3b, 0x60, 0xa2, 0x41, 0x4c, 0x9b, 0x3b, 0x26, 0xd9, 0x53, 0x46, 0x8a, 0xd2, 0x62, 0xae, 0xf2, - 0xf8, 0xa4, 0x5d, 0x58, 0x83, 0x88, 0xfb, 0x91, 0xad, 0x39, 0x38, 0xd0, 0x05, 0x69, 0xd3, 0xb2, - 0xd9, 0x32, 0xc2, 0xdd, 0xa3, 0xce, 0x5b, 0xc4, 0x63, 0x5a, 0xe5, 0x65, 0x6d, 0x75, 0xed, 0x61, - 0x2d, 0xb2, 0x5f, 0x79, 0x2d, 0x63, 0xbc, 0x41, 0x2a, 0xdc, 0xa9, 0xed, 0xc9, 0x77, 0x41, 0x8e, - 0x71, 0x8b, 0x72, 0xd3, 0xf7, 0x10, 0xf4, 0xb9, 0x92, 0x2e, 0x4a, 0x8b, 0xa3, 0x46, 0x36, 0x8e, - 0x6d, 0xc5, 0x21, 0xb9, 0x08, 0x72, 0x61, 0x14, 0x98, 0x24, 0xb2, 0x4d, 0x6a, 0x85, 0xae, 0x32, - 0x1a, 0x43, 0x40, 0x18, 0x05, 0x42, 0xb6, 0xac, 0x02, 0xe0, 0xc4, 0xff, 0x11, 0x78, 0x21, 0x57, - 0xc6, 0x3a, 0xda, 0x8c, 0x4b, 0x11, 0xb9, 0x0a, 0xd2, 0x0c, 0x41, 0x25, 0x13, 0x8b, 0x7e, 0x7a, - 0xd2, 0x2e, 0x3c, 0xfa, 0x33, 0xd1, 0x75, 0x04, 0x43, 0x8b, 0x47, 0xd4, 0x33, 0x3a, 0xf7, 0x6c, - 0x64, 0x3f, 0x9c, 0x1f, 0x2e, 0x89, 0xb6, 0x94, 0x54, 0x30, 0x3f, 0xa8, 0x8d, 0x86, 0xc7, 0x08, - 0x0e, 0x99, 0x57, 0xfa, 0x92, 0x06, 0x53, 0x55, 0x06, 0x37, 0x5d, 0xf7, 0x85, 0xb0, 0xa2, 0x8e, - 0xe0, 0xbf, 0x6f, 0xb2, 0xdd, 0xc4, 0xce, 0xde, 0x95, 0x26, 0xc7, 0x31, 0xd1, 0xe4, 0x5d, 0xf0, - 0x5f, 0x5f, 0x83, 0x73, 0x95, 0x8d, 0x93, 0x76, 0x61, 0x7d, 0x58, 0xde, 0xba, 0xe3, 0x87, 0x98, - 0x52, 0xd1, 0x00, 0x63, 0x9c, 0x08, 0x67, 0x34, 0x30, 0x16, 0x8f, 0x72, 0x6c, 0x4a, 0xb6, 0xac, - 0x68, 0xbd, 0x51, 0xd7, 0x92, 0x51, 0xd7, 0x6a, 0x9d, 0xbc, 0x91, 0xc0, 0xe4, 0x05, 0x30, 0x99, - 0x28, 0xb5, 0x08, 0x31, 0x7d, 0x8b, 0xf9, 0x89, 0x69, 0x46, 0xa2, 0x7f, 0x93, 0x90, 0x2d, 0x8b, - 0xf9, 0xf2, 0x5b, 0x90, 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8e, 0x4f, 0x55, 0xe9, 0xe7, 0xa9, - 0x2a, 0x7d, 0x3c, 0x53, 0x53, 0xc7, 0x67, 0x6a, 0xea, 0xc7, 0x99, 0x9a, 0x7a, 0x53, 0xfe, 0xfd, - 0x28, 0x1e, 0xf4, 0x9e, 0xe7, 0x78, 0x2a, 0xed, 0x4c, 0xfc, 0x36, 0xaf, 0xfe, 0x0a, 0x00, 0x00, - 0xff, 0xff, 0x0a, 0x87, 0xfa, 0xed, 0x5b, 0x06, 0x00, 0x00, + // 774 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xcf, 0x4f, 0x1b, 0x47, + 0x18, 0xf5, 0x62, 0x30, 0x65, 0x6c, 0x81, 0xd8, 0x22, 0x58, 0x0c, 0x5d, 0x1b, 0x17, 0x55, 0x14, + 0x95, 0xdd, 0x62, 0x10, 0x6d, 0xdd, 0x13, 0xae, 0x5a, 0x51, 0x15, 0xab, 0xd6, 0x1a, 0x2e, 0x91, + 0xa2, 0xd5, 0xfe, 0xf2, 0xec, 0x04, 0xef, 0xce, 0x64, 0x66, 0x16, 0xe1, 0x1b, 0xca, 0x29, 0xc7, + 0x1c, 0x72, 0xca, 0x29, 0x7f, 0x02, 0x87, 0x5c, 0x73, 0x8c, 0xc4, 0x11, 0xe5, 0x14, 0x71, 0xb0, + 0x22, 0x38, 0xf0, 0x6f, 0x44, 0xde, 0x5d, 0xdb, 0x18, 0x6c, 0xc5, 0xe4, 0xc0, 0xcd, 0x33, 0xdf, + 0x9b, 0xf9, 0xde, 0xbc, 0xf7, 0x3e, 0x2f, 0x58, 0x36, 0x0d, 0xb3, 0xd9, 0xc0, 0xbe, 0x5a, 0x47, + 0xbe, 0xd1, 0x40, 0xbc, 0xa9, 0x1e, 0x6f, 0xaa, 0xfc, 0x44, 0x21, 0x14, 0x73, 0x2c, 0x7e, 0x1f, + 0x57, 0x95, 0x4e, 0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0x5c, 0xb7, 0x93, 0x09, 0x32, 0x7d, 0xa1, 0x5a, 0x1d, + 0x76, 0xfe, 0x36, 0x2a, 0xfb, 0xcb, 0x28, 0xa8, 0x6e, 0x8f, 0x53, 0x01, 0xcc, 0x0f, 0xc9, 0xc1, + 0x50, 0xba, 0x83, 0xf1, 0xd9, 0x9d, 0x87, 0xe1, 0x3b, 0x14, 0xb2, 0x13, 0xa7, 0x37, 0x67, 0xeb, + 0x42, 0x79, 0xff, 0xfc, 0x4a, 0x16, 0x2e, 0xae, 0x64, 0xe1, 0xf3, 0x95, 0x2c, 0xbc, 0xba, 0x96, + 0x13, 0x17, 0xd7, 0x72, 0xe2, 0xd3, 0xb5, 0x9c, 0x78, 0x52, 0xfc, 0x7a, 0xc2, 0x4e, 0x7a, 0xdf, + 0xb8, 0x30, 0x6c, 0x66, 0x2a, 0xfc, 0xc0, 0x6d, 0x7d, 0x09, 0x00, 0x00, 0xff, 0xff, 0x64, 0x3e, + 0x90, 0x65, 0xa0, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -444,6 +527,9 @@ type MsgClient interface { // TODO: msg for evidence of equivocation. this is not specified yet // UpdateParams updates the finality module parameters. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // UnjailFinalityProvider defines a method for unjailing a jailed + // finality provider, thus it can receive voting power + UnjailFinalityProvider(ctx context.Context, in *MsgUnjailFinalityProvider, opts ...grpc.CallOption) (*MsgUnjailFinalityProviderResponse, error) } type msgClient struct { @@ -481,6 +567,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) UnjailFinalityProvider(ctx context.Context, in *MsgUnjailFinalityProvider, opts ...grpc.CallOption) (*MsgUnjailFinalityProviderResponse, error) { + out := new(MsgUnjailFinalityProviderResponse) + err := c.cc.Invoke(ctx, "/babylon.finality.v1.Msg/UnjailFinalityProvider", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CommitPubRandList commits a list of public randomness for EOTS @@ -490,6 +585,9 @@ type MsgServer interface { // TODO: msg for evidence of equivocation. this is not specified yet // UpdateParams updates the finality module parameters. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // UnjailFinalityProvider defines a method for unjailing a jailed + // finality provider, thus it can receive voting power + UnjailFinalityProvider(context.Context, *MsgUnjailFinalityProvider) (*MsgUnjailFinalityProviderResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -505,6 +603,9 @@ func (*UnimplementedMsgServer) AddFinalitySig(ctx context.Context, req *MsgAddFi func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) UnjailFinalityProvider(ctx context.Context, req *MsgUnjailFinalityProvider) (*MsgUnjailFinalityProviderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnjailFinalityProvider not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -564,6 +665,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UnjailFinalityProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUnjailFinalityProvider) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UnjailFinalityProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.finality.v1.Msg/UnjailFinalityProvider", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UnjailFinalityProvider(ctx, req.(*MsgUnjailFinalityProvider)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylon.finality.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -580,6 +699,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "UnjailFinalityProvider", + Handler: _Msg_UnjailFinalityProvider_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "babylon/finality/v1/tx.proto", @@ -855,6 +978,71 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgUnjailFinalityProvider) 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 *MsgUnjailFinalityProvider) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnjailFinalityProvider) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.FpBtcPk != nil { + { + size := m.FpBtcPk.Size() + i -= size + if _, err := m.FpBtcPk.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUnjailFinalityProviderResponse) 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 *MsgUnjailFinalityProviderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnjailFinalityProviderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -975,6 +1163,32 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgUnjailFinalityProvider) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.FpBtcPk != nil { + l = m.FpBtcPk.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUnjailFinalityProviderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1746,6 +1960,173 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUnjailFinalityProvider) 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 ErrIntOverflowTx + } + 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: MsgUnjailFinalityProvider: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnjailFinalityProvider: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FpBtcPk", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_babylonlabs_io_babylon_types.BIP340PubKey + m.FpBtcPk = &v + if err := m.FpBtcPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUnjailFinalityProviderResponse) 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 ErrIntOverflowTx + } + 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: MsgUnjailFinalityProviderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnjailFinalityProviderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0