diff --git a/babylon/btccheckpoint/v1/genesis.proto b/babylon/btccheckpoint/v1/genesis.proto index b25a532..5102118 100644 --- a/babylon/btccheckpoint/v1/genesis.proto +++ b/babylon/btccheckpoint/v1/genesis.proto @@ -16,7 +16,7 @@ message GenesisState { // Epochs data for each stored epoch repeated EpochEntry epochs = 3 [ (gogoproto.nullable) = false ]; // Submission data for each stored submission key - repeated SubmissionEntry submissions = 4 [(gogoproto.nullable) = false ]; + repeated SubmissionEntry submissions = 4 [ (gogoproto.nullable) = false ]; } // EpochEntry represents data for a specific epoch number. diff --git a/babylon/btcstaking/v1/btcstaking.proto b/babylon/btcstaking/v1/btcstaking.proto index abcf953..3a6e216 100644 --- a/babylon/btcstaking/v1/btcstaking.proto +++ b/babylon/btcstaking/v1/btcstaking.proto @@ -44,8 +44,9 @@ message FinalityProvider { // highest_voted_height is the highest height for which the // finality provider has voted uint32 highest_voted_height = 9; - // bsn_id is the ID of the BSN the finality provider is securing - string bsn_id = 10; + // NOTE: consumer_id field is not yet backported to the release branch. + // To keep it consistent with the code on main branch, consumer_info has field number 11 instead of 10. + // commission_info contains information details of the finality provider commission. CommissionInfo commission_info = 11; } @@ -113,7 +114,8 @@ message BTCDelegation { ProofOfPossessionBTC pop = 3; // fp_btc_pk_list is the list of BIP-340 PKs of the finality providers that // this BTC delegation delegates to - // If there are more than 1 PKs, then this means the delegation is multi-staked + // If there is more than 1 PKs, then this means the delegation is restaked + // to multiple finality providers repeated bytes fp_btc_pk_list = 4 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; @@ -279,9 +281,8 @@ message CovenantAdaptorSignatures { bytes cov_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; - // adaptor_sigs is a list of adaptor signatures, each encrypted - // by the finality provider public keys involved in the multi-staking - // procedure + // adaptor_sigs is a list of adaptor signatures, each encrypted by a restaked + // BTC finality provider's public key repeated bytes adaptor_sigs = 2; } @@ -299,8 +300,8 @@ message SelectiveSlashingEvidence { // fp_btc_pk is the BTC PK of the finality provider who // launches the selective slashing offence bytes fp_btc_pk = 2 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + [ (gogoproto.customtype) = + "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; // recovered_fp_btc_sk is the finality provider's BTC SK recovered from // the covenant adaptor/Schnorr signature pair. It is the consequence // of selective slashing. diff --git a/babylon/btcstaking/v1/events.proto b/babylon/btcstaking/v1/events.proto index 66f2bc5..e63f8ac 100644 --- a/babylon/btcstaking/v1/events.proto +++ b/babylon/btcstaking/v1/events.proto @@ -4,16 +4,9 @@ package babylon.btcstaking.v1; import "gogoproto/gogo.proto"; import "babylon/btcstaking/v1/btcstaking.proto"; import "amino/amino.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/babylonlabs-io/babylon/v4/x/btcstaking/types"; -// EventNewFinalityProvider is the event emitted when new finality provider is created -message EventNewFinalityProvider { - FinalityProvider fp = 1; -} - // EventFinalityProviderCreated is the event emitted when a finality provider is created message EventFinalityProviderCreated { // btc_pk_hex is the hex string of Bitcoin secp256k1 PK of this finality provider @@ -32,8 +25,6 @@ message EventFinalityProviderCreated { string security_contact = 7; // details define other optional details. string details = 8; - // bsn_id is the id of the BSN - string bsn_id = 9 [(amino.dont_omitempty) = true]; } // EventFinalityProviderEdited is the event emitted when a finality provider is edited @@ -82,19 +73,19 @@ message EventPowerDistUpdate { // is slashed // TODO: unify with existing slashing events message EventSlashedFinalityProvider { - bytes pk = 1 [(gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey"]; + bytes pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/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/v4/types.BIP340PubKey"]; + bytes pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/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/v4/types.BIP340PubKey"]; + bytes pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; } // ev is the event that affects voting power distribution @@ -261,34 +252,3 @@ message EventUnexpectedUnbondingTx { // spend_stake_tx_block_index is the spend_stake_tx index in the block uint32 spend_stake_tx_block_index = 4 [(amino.dont_omitempty) = true]; } - -// EventAddBsnRewards event that rewards were added for BSN finality providers -message EventAddBsnRewards { - // Sender is the babylon address which paid for the rewards - string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // BsnConsumerId is the ID of the BSN consumer - string bsn_consumer_id = 2; - // TotalRewards is the total amount of rewards that were distributed - repeated cosmos.base.v1beta1.Coin total_rewards = 3 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; - // BabylonCommission is the amount of commission collected by Babylon - repeated cosmos.base.v1beta1.Coin babylon_commission = 4 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; - // FpRatios contains the finality providers and their respective reward ratios - repeated EventFpRewardInfo fp_ratios = 5 [(gogoproto.nullable) = false]; -} - -// EventFpRewardInfo contains finality provider reward information for events -message EventFpRewardInfo { - // BtcPK is the Bitcoin secp256k1 PK of the finality provider - string fp_btc_pk_hex = 1 [(amino.dont_omitempty) = true]; - // TotalRewards is the total amount allocated to this finality provider - repeated cosmos.base.v1beta1.Coin total_rewards = 2 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} diff --git a/babylon/btcstaking/v1/genesis.proto b/babylon/btcstaking/v1/genesis.proto index ebcb4f1..0a8336e 100644 --- a/babylon/btcstaking/v1/genesis.proto +++ b/babylon/btcstaking/v1/genesis.proto @@ -5,7 +5,6 @@ import "gogoproto/gogo.proto"; import "babylon/btcstaking/v1/params.proto"; import "babylon/btcstaking/v1/btcstaking.proto"; import "babylon/btcstaking/v1/events.proto"; -import "babylon/btcstaking/v1/packet.proto"; option go_package = "github.com/babylonlabs-io/babylon/v4/x/btcstaking/types"; @@ -24,12 +23,12 @@ message GenesisState { repeated BTCDelegator btc_delegators = 6; // all the events and its indexes. repeated EventIndex events = 7; - // Reserved for previous collection of the allowed staking transaction hashes (hex encoded) - reserved 8; + // collection of the allowed staking transaction hashes (hex encoded) + repeated string allowed_staking_tx_hashes = 8; // largest BTC block reorg LargestBtcReOrg largest_btc_reorg = 9; - // all consumer chain events - repeated ConsumerEvent consumer_events = 10; + // Reserved for consumer chain events + reserved 10; // Reserved for previous collection of the allowed multi-staking transaction hashes (hex encoded) reserved 11; // FpBbnAddr defines a list of the finality provider indexed by their babylon address. @@ -69,12 +68,3 @@ message EventIndex { // event the event stored. EventPowerDistUpdate event = 3; } - -// ConsumerEvent contains the events belonging to a specific consumer chain. -message ConsumerEvent { - // consumer_id is the identifier of the consumer chain - string consumer_id = 1; - // events holds all the events (NewFinalityProvider, ActiveBTCDelegation, UnbondedBTCDelegation) - // for the consumer chain - BTCStakingIBCPacket events = 2; -} diff --git a/babylon/btcstaking/v1/params.proto b/babylon/btcstaking/v1/params.proto index cab469d..daee7df 100644 --- a/babylon/btcstaking/v1/params.proto +++ b/babylon/btcstaking/v1/params.proto @@ -61,16 +61,13 @@ message Params { ]; // base gas fee for delegation creation uint64 delegation_creation_base_gas_fee = 13; - // DEPRECATED: allow_list_expiration_height is the height at which the allow list expires + // allow_list_expiration_height is the height at which the allow list expires // i.e all staking transactions are allowed to enter Babylon chain afterwards - // setting it to 0 means allow list is disabled (LEGACY) - uint64 allow_list_expiration_height = 14 [deprecated = true]; + // setting it to 0 means allow list is disabled + uint64 allow_list_expiration_height = 14; // btc_activation_height is the btc height from which parameters are activated // (inclusive) uint32 btc_activation_height = 15; - // max_finality_providers is the maximum number of finality providers that can - // be used in staking script - uint32 max_finality_providers = 16; } // HeightVersionPair pairs a btc height with a version of the parameters diff --git a/babylon/btcstaking/v1/query.proto b/babylon/btcstaking/v1/query.proto index d6757e5..32242dd 100644 --- a/babylon/btcstaking/v1/query.proto +++ b/babylon/btcstaking/v1/query.proto @@ -32,47 +32,34 @@ service Query { option (google.api.http).get = "/babylon/btcstaking/v1/params/{version}"; } - // ParamsByBTCHeight queries the parameters of the module for a specific BTC - // height - rpc ParamsByBTCHeight(QueryParamsByBTCHeightRequest) - returns (QueryParamsByBTCHeightResponse) { - option (google.api.http).get = - "/babylon/btcstaking/v1/params/btc_height/{btc_height}"; + // ParamsByBTCHeight queries the parameters of the module for a specific BTC height + rpc ParamsByBTCHeight(QueryParamsByBTCHeightRequest) returns (QueryParamsByBTCHeightResponse) { + option (google.api.http).get = "/babylon/btcstaking/v1/params/btc_height/{btc_height}"; } // FinalityProviders queries all finality providers - rpc FinalityProviders(QueryFinalityProvidersRequest) - returns (QueryFinalityProvidersResponse) { - option (google.api.http).get = "/babylon/btcstaking/v1/finality_providers/{bsn_id}"; + rpc FinalityProviders(QueryFinalityProvidersRequest) returns (QueryFinalityProvidersResponse) { + option (google.api.http).get = "/babylon/btcstaking/v1/finality_providers"; } // FinalityProvider info about one finality provider - rpc FinalityProvider(QueryFinalityProviderRequest) - returns (QueryFinalityProviderResponse) { - option (google.api.http).get = "/babylon/btcstaking/v1/finality_providers/" - "{fp_btc_pk_hex}/finality_provider"; + rpc FinalityProvider(QueryFinalityProviderRequest) returns (QueryFinalityProviderResponse) { + option (google.api.http).get = "/babylon/btcstaking/v1/finality_providers/{fp_btc_pk_hex}/finality_provider"; } // BTCDelegations queries all BTC delegations under a given status - rpc BTCDelegations(QueryBTCDelegationsRequest) - returns (QueryBTCDelegationsResponse) { - option (google.api.http).get = - "/babylon/btcstaking/v1/btc_delegations/{status}"; + rpc BTCDelegations(QueryBTCDelegationsRequest) returns (QueryBTCDelegationsResponse) { + option (google.api.http).get = "/babylon/btcstaking/v1/btc_delegations/{status}"; } - // FinalityProviderDelegations queries all BTC delegations of the given - // finality provider - rpc FinalityProviderDelegations(QueryFinalityProviderDelegationsRequest) - returns (QueryFinalityProviderDelegationsResponse) { - option (google.api.http).get = - "/babylon/btcstaking/v1/finality_providers/{fp_btc_pk_hex}/delegations"; + // FinalityProviderDelegations queries all BTC delegations of the given finality provider + rpc FinalityProviderDelegations(QueryFinalityProviderDelegationsRequest) returns (QueryFinalityProviderDelegationsResponse) { + option (google.api.http).get = "/babylon/btcstaking/v1/finality_providers/{fp_btc_pk_hex}/delegations"; } // BTCDelegation retrieves delegation by corresponding staking tx hash - rpc BTCDelegation(QueryBTCDelegationRequest) - returns (QueryBTCDelegationResponse) { - option (google.api.http).get = - "/babylon/btcstaking/v1/btc_delegation/{staking_tx_hash_hex}"; + rpc BTCDelegation(QueryBTCDelegationRequest) returns (QueryBTCDelegationResponse) { + option (google.api.http).get = "/babylon/btcstaking/v1/btc_delegation/{staking_tx_hash_hex}"; } // LargestBtcReOrg retrieves the largest BTC reorg @@ -87,27 +74,29 @@ message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { // params holds all the parameters of this module. - Params params = 1 [ (gogoproto.nullable) = false ]; + Params params = 1 [(gogoproto.nullable) = false]; } // QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsByVersionRequest { uint32 version = 1; } +message QueryParamsByVersionRequest { + uint32 version = 1; +} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsByVersionResponse { // params holds all the parameters of this module. - Params params = 1 [ (gogoproto.nullable) = false ]; + Params params = 1 [(gogoproto.nullable) = false]; } -// QueryParamsByBTCHeightRequest is request type for the Query/ParamsByBTCHeight -// RPC method. -message QueryParamsByBTCHeightRequest { uint32 btc_height = 1; } +// QueryParamsByBTCHeightRequest is request type for the Query/ParamsByBTCHeight RPC method. +message QueryParamsByBTCHeightRequest { + uint32 btc_height = 1; +} -// QueryParamsByBTCHeightResponse is response type for the -// Query/QueryParamsByBTCHeightResponse RPC method. +// QueryParamsByBTCHeightResponse is response type for the Query/QueryParamsByBTCHeightResponse RPC method. message QueryParamsByBTCHeightResponse { // params holds all the parameters of this module. - Params params = 1 [ (gogoproto.nullable) = false ]; + Params params = 1 [(gogoproto.nullable) = false]; // version is the version of the params for the given BTC height uint32 version = 2; @@ -118,9 +107,6 @@ message QueryParamsByBTCHeightResponse { message QueryFinalityProvidersRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; - // bsn_id allows to specify for which BSN to return finality providers for. - // Defaults to the Babylon Genesis BSN ID - string bsn_id = 2; } // QueryFinalityProvidersResponse is the response type for the @@ -133,10 +119,10 @@ message QueryFinalityProvidersResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } + // QueryFinalityProviderRequest requests information about a finality provider message QueryFinalityProviderRequest { - // fp_btc_pk_hex is the hex str of Bitcoin secp256k1 PK of the finality - // provider + // fp_btc_pk_hex is the hex str of Bitcoin secp256k1 PK of the finality provider string fp_btc_pk_hex = 1; } @@ -159,8 +145,7 @@ message QueryBTCDelegationsRequest { // QueryBTCDelegationsResponse is the response type for the // Query/BTCDelegations RPC method. message QueryBTCDelegationsResponse { - // btc_delegations contains all the queried BTC delegations under the given - // status + // btc_delegations contains all the queried BTC delegations under the given status repeated BTCDelegationResponse btc_delegations = 1; // pagination defines the pagination in the response. @@ -170,9 +155,9 @@ message QueryBTCDelegationsResponse { // QueryFinalityProviderDelegationsRequest is the request type for the // Query/FinalityProviderDelegations RPC method. message QueryFinalityProviderDelegationsRequest { - // fp_btc_pk_hex is the hex str of Bitcoin secp256k1 PK of the finality - // providerthat this BTC delegation delegates to the PK follows encoding in - // BIP-340 spec + // fp_btc_pk_hex is the hex str of Bitcoin secp256k1 PK of the finality providerthat + // this BTC delegation delegates to + // the PK follows encoding in BIP-340 spec string fp_btc_pk_hex = 1; // pagination defines an optional pagination for the request. @@ -196,30 +181,24 @@ message QueryBTCDelegationRequest { string staking_tx_hash_hex = 1; } -// QueryBTCDelegationResponse is response type matching -// QueryBTCDelegationRequest and containing BTC delegation information +// QueryBTCDelegationResponse is response type matching QueryBTCDelegationRequest +// and containing BTC delegation information message QueryBTCDelegationResponse { // BTCDelegation represents the client needed information of an BTCDelegation. BTCDelegationResponse btc_delegation = 1; } -// BTCDelegationResponse is the client needed information from a BTCDelegation -// with the current status based on parameters. +// BTCDelegationResponse is the client needed information from a BTCDelegation with the current status based on parameters. message BTCDelegationResponse { // staker_addr is the address to receive rewards from BTC delegation. - string staker_addr = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string staker_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // btc_pk is the Bitcoin secp256k1 PK of this BTC delegation // the PK follows encoding in BIP-340 spec - bytes btc_pk = 2 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + bytes btc_pk = 2 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; // fp_btc_pk_list is the list of BIP-340 PKs of the finality providers that // this BTC delegation delegates to - repeated bytes fp_btc_pk_list = 3 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; - // staking_time is the number of blocks for which the delegation is locked on - // BTC chain + repeated bytes fp_btc_pk_list = 3 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + // staking_time is the number of blocks for which the delegation is locked on BTC chain uint32 staking_time = 4; // start_height is the start BTC height of the BTC delegation // it is the start BTC height of the timelock @@ -248,8 +227,8 @@ message BTCDelegationResponse { bool active = 13; // descriptive status of current delegation. string status_desc = 14; - // unbonding_time used in unbonding output timelock path and in slashing - // transactions change outputs + // unbonding_time used in unbonding output timelock path and in slashing transactions + // change outputs uint32 unbonding_time = 15; // undelegation_response is the undelegation info of this delegation. BTCUndelegationResponse undelegation_response = 16; @@ -285,16 +264,15 @@ message StakeExpansionResponse { // which spent the staking output message DelegatorUnbondingInfoResponse { // spend_stake_tx_hex is the transaction which spent the staking output. It is - // filled only if the spend_stake_tx_hex is different than the - // unbonding_tx_hex + // filled only if the spend_stake_tx_hex is different than the unbonding_tx_hex string spend_stake_tx_hex = 1; } // BTCUndelegationResponse provides all necessary info about the undeleagation message BTCUndelegationResponse { // unbonding_tx is the transaction which will transfer the funds from staking - // output to unbonding output. Unbonding output will usually have lower - // timelock than staking output. The unbonding tx as string hex. + // output to unbonding output. Unbonding output will usually have lower timelock + // than staking output. The unbonding tx as string hex. string unbonding_tx_hex = 1; // covenant_unbonding_sig_list is the list of signatures on the unbonding tx // by covenant members @@ -315,29 +293,25 @@ message BTCUndelegationResponse { DelegatorUnbondingInfoResponse delegator_unbonding_info_response = 6; } -// BTCDelegatorDelegationsResponse is a collection of BTC delegations responses -// from the same delegator. +// BTCDelegatorDelegationsResponse is a collection of BTC delegations responses from the same delegator. message BTCDelegatorDelegationsResponse { repeated BTCDelegationResponse dels = 1; } -// FinalityProviderResponse defines a finality provider with voting power -// information. +// FinalityProviderResponse defines a finality provider with voting power information. message FinalityProviderResponse { // description defines the description terms for the finality provider. cosmos.staking.v1beta1.Description description = 1; // commission defines the commission rate of the finality provider. string commission = 2 [ - (cosmos_proto.scalar) = "cosmos.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec" ]; // addr is the address to receive commission from delegations. - string addr = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string addr = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // btc_pk is the Bitcoin secp256k1 PK of this finality provider // the PK follows encoding in BIP-340 spec - bytes btc_pk = 4 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + bytes btc_pk = 4 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; // pop is the proof of possession of the BTC_PK by the fp addr. // Essentially is the signature where the BTC SK sigs the fp addr. ProofOfPossessionBTC pop = 5; @@ -356,11 +330,10 @@ message FinalityProviderResponse { // highest_voted_height is the highest height for which the // finality provider has voted uint32 highest_voted_height = 10; - // commission_info contains information details of the finality provider - // commission. + // commission_info contains information details of the finality provider commission. CommissionInfo commission_info = 11; // bsn_id is the ID of the BSN the finality provider is securing - string bsn_id = 12; + reserved 12; // soft_deleted defines if the fp is soft deleted or not. If it is soft // deleted the FP can't cast votes. bool soft_deleted = 13; @@ -380,6 +353,7 @@ message QueryLargestBtcReOrgResponse { babylon.btclightclient.v1.BTCHeaderInfoResponse rollback_to = 3; } + // QueryParamsVersionsRequest is the request type for the // Query/ParamsVersions RPC method. message QueryParamsVersionsRequest { @@ -400,4 +374,4 @@ message QueryParamsVersionsResponse { // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; -} +} \ No newline at end of file diff --git a/babylon/btcstaking/v1/tx.proto b/babylon/btcstaking/v1/tx.proto index 91d749b..0971722 100644 --- a/babylon/btcstaking/v1/tx.proto +++ b/babylon/btcstaking/v1/tx.proto @@ -9,7 +9,6 @@ import "cosmos/staking/v1beta1/staking.proto"; import "babylon/btcstaking/v1/pop.proto"; import "babylon/btcstaking/v1/btcstaking.proto"; import "amino/amino.proto"; -import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/babylonlabs-io/babylon/v4/x/btcstaking/types"; @@ -43,9 +42,6 @@ service Msg { rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); // BtcStakeExpand expands an previous active BTC delegation into a new one rpc BtcStakeExpand(MsgBtcStakeExpand) returns (MsgBtcStakeExpandResponse); - // AddBsnRewards defines a method to add additional rewards for finality providers - // and their BTC delegators with specified distribution ratios - rpc AddBsnRewards(MsgAddBsnRewards) returns (MsgAddBsnRewardsResponse); } // MsgCreateFinalityProvider is the message for creating a finality provider @@ -66,12 +62,12 @@ message MsgCreateFinalityProvider { "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; // pop is the proof of possession of btc_pk over the FP signer address. ProofOfPossessionBTC pop = 5; + // NOTE: consumer_id field is not yet backported to the release branch. + // To keep it consistent with the code on main branch, commission has field number 7 instead of 6. + // commission is the finality provider commission information CommissionRates commission = 7 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - // bsn_id is the ID of the BSN - // If it's empty, it's assumed to be Babylon's chain id - string bsn_id = 8; } // MsgCreateFinalityProviderResponse is the response for @@ -376,42 +372,3 @@ message MsgUpdateParams { // MsgUpdateParamsResponse is the response to the MsgUpdateParams message. message MsgUpdateParamsResponse {} - -// MsgAddBsnRewards adds rewards for finality providers of a specific BSN consumer -message MsgAddBsnRewards { - option (cosmos.msg.v1.signer) = "sender"; - - // Sender is the babylon address which will pay for the rewards - string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // BsnConsumerId is the ID of the BSN consumer - // - for Cosmos SDK chains, the consumer ID will be the IBC client ID - // - for rollup chains, the consumer ID will be the chain ID of the rollup - // chain - string bsn_consumer_id = 2; - // TotalRewards is the total amount of rewards to be distributed among finality providers. - // This amount will be distributed according to the ratios specified in fp_ratios. - repeated cosmos.base.v1beta1.Coin total_rewards = 3 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; - // FpRatios is a list of finality providers and their respective reward distribution ratios. - // The ratios should sum to 1.0 to distribute the entire total_rewards amount. - repeated FpRatio fp_ratios = 4 [ (gogoproto.nullable) = false ]; -} - -// FpRatio defines the finality provider identifier and their reward distribution ratio -message FpRatio { - // BtcPK is the Bitcoin secp256k1 PK of the finality provider - bytes btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; - // Ratio is the proportion of total_rewards that this finality provider and their BTC stakers - // should receive. Must be a decimal between 0 and 1. The sum of all ratios in fp_ratios - // should equal 1.0. From the calculated reward amount, the babylon genesis commission and - // finality provider commission will be deducted before allocating to BTC stakers. - string ratio = 2 [ - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; -} - -// MsgAddBsnRewardsResponse defines the Msg/AddBsnRewards response type. -message MsgAddBsnRewardsResponse {} diff --git a/babylon/costaking/v1/costaking.proto b/babylon/costaking/v1/costaking.proto new file mode 100644 index 0000000..75f970b --- /dev/null +++ b/babylon/costaking/v1/costaking.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; +package babylon.costaking.v1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/babylonlabs-io/babylon/v4/x/costaking/types"; + +// Params defines the parameters for the module. +message Params { + // CostakingPortion is the portion of rewards that goes to costakers + // NOTE: This portion of costakers is taken after the incentive module + // takes part of the fee_collector to give out to BTC stakers. + string costaking_portion = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + // ScoreRatioBtcByBaby defines the amount of ubbn necessary for the + // sats staked to count as score in the formula. + // score: min(costakers_sats_staked, (costakers_ubbn_staked / + // score_ratio_btc_by_baby)) + bytes score_ratio_btc_by_baby = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // ValidatorsPortion is the portion of rewards that goes to Babylon Validators + // NOTE: This portion of validators is taken after the incentive module + // takes part of the fee_collector balance to give out to validators that + // correctly voted. + string validators_portion = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} + +// Validator is a message that denotes a validator +message Validator { + // addr is the validator's address (in sdk.ValAddress) + bytes addr = 1; + // tokens define the delegated tokens (incl. self-delegation). + bytes tokens = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // shares defines total shares issued to a validator's delegators. + string shares = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} + +// ValidatorSet is a message that denotes a set of validators +message ValidatorSet { + // validators is the list of all validators and their delegated tokens. + repeated Validator validators = 1; +} \ No newline at end of file diff --git a/babylon/costaking/v1/events.proto b/babylon/costaking/v1/events.proto new file mode 100644 index 0000000..09a5531 --- /dev/null +++ b/babylon/costaking/v1/events.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package babylon.costaking.v1; + +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/babylonlabs-io/babylon/v4/x/costaking/types"; + +// EventCostakersAddRewards is the event emitted when new rewards are given to costakers. +message EventCostakersAddRewards { + // AddRewards are the coins added to the current coostaker reward tracker pool. + repeated cosmos.base.v1beta1.Coin add_rewards = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // CurrentRewards are the reward coins available for this period. + repeated cosmos.base.v1beta1.Coin current_rewards = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // CurrentPeriod is the period where the rewards are being added. + uint64 current_period = 3; + // CurrentTotalScore is the total amount of score in which the rewards will be + // equaly distributed. + bytes current_total_score = 4 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} diff --git a/babylon/costaking/v1/genesis.proto b/babylon/costaking/v1/genesis.proto new file mode 100644 index 0000000..dfed81b --- /dev/null +++ b/babylon/costaking/v1/genesis.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; +package babylon.costaking.v1; + +import "gogoproto/gogo.proto"; +import "babylon/costaking/v1/costaking.proto"; +import "babylon/costaking/v1/rewards.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/babylonlabs-io/babylon/v4/x/costaking/types"; + +// GenesisState defines the costaking module's genesis state. +message GenesisState { + // params the current params of the state. + Params params = 1 [ (gogoproto.nullable) = false ]; + // CurrentRewards are the current rewards of costakers pool. + CurrentRewardsEntry current_rewards = 2 [ (gogoproto.nullable) = false ]; + // HistoricalRewards are the historical rewards of the costakers for one + // period. + repeated HistoricalRewardsEntry historical_rewards = 3 + [ (gogoproto.nullable) = false ]; + // costakers_rewards_tracker are the costaker rewards tracker stored by + // costaker addresses. + repeated CostakerRewardsTrackerEntry costakers_rewards_tracker = 4 + [ (gogoproto.nullable) = false ]; + // validator_set contains all validators and their delegated tokens. + ValidatorSet validator_set = 5 + [ (gogoproto.nullable) = false ]; +} + +// CurrentRewardsEntry represents the chain current rewards. +message CurrentRewardsEntry { + // Rewards the costaker rewards + CurrentRewards rewards = 1; +} + +// HistoricalRewardsEntry represents the pool of +// historical rewards by period. +message HistoricalRewardsEntry { + // Period of the historical reward + uint64 period = 1; + // Rewards the period historical rewards + HistoricalRewards rewards = 2; +} + +// CostakerRewardsTrackerEntry represents a costaker rewards +// tracker entry based on the costaker address +message CostakerRewardsTrackerEntry { + // costakerAddress babylon address of the costaker + string costaker_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Tracker is costaker reward tracker information. + CostakerRewardsTracker tracker = 2; +} diff --git a/babylon/costaking/v1/query.proto b/babylon/costaking/v1/query.proto new file mode 100644 index 0000000..b9332b3 --- /dev/null +++ b/babylon/costaking/v1/query.proto @@ -0,0 +1,150 @@ +syntax = "proto3"; +package babylon.costaking.v1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos_proto/cosmos.proto"; +import "babylon/costaking/v1/costaking.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/babylonlabs-io/babylon/v4/x/costaking/types"; + +// Query defines the gRPC querier service. +service Query { + // Params queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/babylon/costaking/v1/params"; + } + // CostakerRewardsTracker queries the costaker reward tracker. + rpc CostakerRewardsTracker(QueryCostakerRewardsTrackerRequest) + returns (QueryCostakerRewardsTrackerResponse) { + option (google.api.http).get = + "/babylon/costaking/v1/costakers/{costaker_address}/rewards_tracker"; + } + // HistoricalRewards queries the historical rewards structure per period for + // costaking single pool. + rpc HistoricalRewards(QueryHistoricalRewardsRequest) + returns (QueryHistoricalRewardsResponse) { + option (google.api.http).get = + "/babylon/costaking/v1/historical_rewards/{period}"; + } + // CurrentRewards queries the current rewards structure for costaking single + // pool. + rpc CurrentRewards(QueryCurrentRewardsRequest) + returns (QueryCurrentRewardsResponse) { + option (google.api.http).get = "/babylon/costaking/v1/current_rewards"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // Params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryCostakerRewardsTrackerRequest is the request type for the +// Query/CostakerRewardsTracker RPC method. +message QueryCostakerRewardsTrackerRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // costakerAddress defines the delegator address to query for. + string costaker_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// QueryCostakerRewardsTrackerResponse is the response type for the +// Query/CostakerRewardsTracker RPC method. +message QueryCostakerRewardsTrackerResponse { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // StartPeriodCumulativeReward the starting period the costaker + // made his last withdraw of costaking rewards or modified his active staking + // amount of satoshis or baby. + uint64 start_period_cumulative_reward = 1; + // ActiveSatoshis is the total amount of active satoshi delegated + // from this costaker babylon address. + bytes active_satoshis = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // ActiveBaby is the total amount of active baby delegated + // from this costaker babylon address. + bytes active_baby = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // TotalScore is the total amount of calculated score + // of this costaker. + bytes total_score = 4 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} + +// QueryCurrentRewardsRequest is request type for the Query/CurrentRewards RPC +// method. +message QueryCurrentRewardsRequest {} + +// QueryCurrentRewardsResponse is response type for the Query/CurrentRewards RPC +// method. +message QueryCurrentRewardsResponse { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // Rewards is the current rewards for the single pool of rewards for all the + // costakers for the whole chain. If some action happens of satoshi or baby + // staked or is unbonded or withdraw of the rewards available, this current + // period is sent to an HistoricalRewards and a new period is created and + // the rewards property is zerod out. + // Note: This rewards have increased simulated decimals (10^20) to increase + // precision when calculating the rewards per score and protect against + // math overflow issues. The decimals are removed prior to sending out + // to the incentives gauge. + repeated cosmos.base.v1beta1.Coin rewards = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // Period stores the current period that serves as a reference for + // creating new historical rewards and correlate with + // CostakerRewardsTracker StartPeriodCumulativeReward. + uint64 period = 2; + // TotalScore is the total amount of score calulated over + // all the stakers score in the chain. + bytes total_score = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} + +// QueryHistoricalRewardsRequest is request type for the Query/HistoricalRewards +// RPC method. +message QueryHistoricalRewardsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // Period is the historical period which the HistoricalRewards was stored. + uint64 period = 1; +} + +// QueryHistoricalRewardsResponse is response type for the +// Query/HistoricalRewards RPC method. +message QueryHistoricalRewardsResponse { + // CumulativeRewardsPerScore is the cumulative rewards of that period. + // This coins will aways increase the value, never reduced, it always + // accumulates and when the cumulative rewards will be used to distribute + // rewards, 2 periods will be loaded, calculate the difference and multiplied + // by the total score amount of each staker + repeated cosmos.base.v1beta1.Coin cumulative_rewards_per_score = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} diff --git a/babylon/costaking/v1/rewards.proto b/babylon/costaking/v1/rewards.proto new file mode 100644 index 0000000..cf95771 --- /dev/null +++ b/babylon/costaking/v1/rewards.proto @@ -0,0 +1,91 @@ +syntax = "proto3"; +package babylon.costaking.v1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/babylonlabs-io/babylon/v4/x/costaking/types"; + +// HistoricalRewards represents the cumulative rewards ratio of +// the pool of costakers per score in that period. The period is ommited here +// and should be part of the key used to store this structure. Key: Prefix + +// Period. +message HistoricalRewards { + // CumulativeRewardsPerScore is the cumulative rewards of that period. + // This coins will aways increase the value, never reduced, it always + // accumulates and when the cumulative rewards will be used to distribute + // rewards, 2 periods will be loaded, calculate the difference and multiplied + // by the total score amount of each staker + // https://github.com/cosmos/cosmos-sdk/blob/e76102f885b71fd6e1c1efb692052173c4b3c3a3/x/distribution/keeper/delegation.go#L47 + repeated cosmos.base.v1beta1.Coin cumulative_rewards_per_score = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// CurrentRewards represents the current rewards of the pool of costakers. +// Note: This rewards are for the stakers that have BTC delegations and BABY +// delegations. +// Key: Prefix. Since this will be a single pool of rewards for the entire chain +// a single CurrentRewards structure is necessary. +message CurrentRewards { + // Rewards is the current rewards for the single pool of rewards for all the + // costakers for the whole chain. If some action happens of satoshi or baby + // staked or is unbonded or withdraw of the rewards available, this current + // period is sent to an HistoricalRewards and a new period is created and + // the rewards property is zerod out. + // Note: This rewards have increased simulated decimals (10^20) to increase + // precision when calculating the rewards per score and protect against + // math overflow issues. The decimals are removed prior to sending out + // to the incentives gauge. + repeated cosmos.base.v1beta1.Coin rewards = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // Period stores the current period that serves as a reference for + // creating new historical rewards and correlate with + // CostakerRewardsTracker StartPeriodCumulativeReward. + uint64 period = 2; + // TotalScore is the total amount of score calulated over + // all the stakers score in the chain. + bytes total_score = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} + +// CostakerRewardsTracker represents the structure that holds information +// from the last time this staker withdraw the costaking rewards or modified +// his active staked amount of baby or satoshis. +// The babylon address of the staker is ommitted here but should be part of the +// key used to store this structure. +// Key: Prefix + costaker babylon address. +message CostakerRewardsTracker { + // StartPeriodCumulativeReward the starting period the costaker + // made his last withdraw of costaking rewards or modified his active staking + // amount of satoshis or baby. + uint64 start_period_cumulative_reward = 1; + // ActiveSatoshis is the total amount of active satoshi delegated + // from this costaker babylon address. + bytes active_satoshis = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // ActiveBaby is the total amount of active baby delegated + // from this costaker babylon address. + bytes active_baby = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // TotalScore is the total amount of calculated score + // of this costaker. + bytes total_score = 4 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/babylon/costaking/v1/tx.proto b/babylon/costaking/v1/tx.proto new file mode 100644 index 0000000..738f379 --- /dev/null +++ b/babylon/costaking/v1/tx.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; +package babylon.costaking.v1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "babylon/costaking/v1/costaking.proto"; + +option go_package = "github.com/babylonlabs-io/babylon/v4/x/costaking/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams updates the costaking module parameters. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); +} + +// MsgUpdateParams defines a message for updating incentive 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 incentive parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [ (gogoproto.nullable) = false ]; +} +// MsgUpdateParamsResponse is the response to the MsgUpdateParams message. +message MsgUpdateParamsResponse {} diff --git a/babylon/epoching/v1/events.proto b/babylon/epoching/v1/events.proto index f947d04..ef4a78c 100644 --- a/babylon/epoching/v1/events.proto +++ b/babylon/epoching/v1/events.proto @@ -98,3 +98,18 @@ message EventWrappedStakingUpdateParams { string min_commission_rate = 6; uint64 epoch_boundary = 7; } +// EventUnlockFundsFailed is the event emitted when unlocking funds fails. +message EventUnlockFundsFailed { + // epoch_number is the epoch number when the unlock funds operation failed + uint64 epoch_number = 1; + // height is the block height when the message was originally submitted + uint64 height = 2; + // tx_id is the ID of the transaction that contains the message + bytes tx_id = 3; + // msg_id is the ID of the queued message + bytes msg_id = 4; + // error is the error message describing why the unlock funds operation failed + string error = 5; + // msg_type is the type of the message that failed to unlock funds + string msg_type = 6; +} diff --git a/babylon/epoching/v1/params.proto b/babylon/epoching/v1/params.proto index 8a51051..5e82ccb 100644 --- a/babylon/epoching/v1/params.proto +++ b/babylon/epoching/v1/params.proto @@ -12,4 +12,24 @@ message Params { // epoch_interval is the number of consecutive blocks to form an epoch uint64 epoch_interval = 1 [ (gogoproto.moretags) = "yaml:\"epoch_interval\"" ]; + + // execute_gas defines raw gas for different executions. + ExecuteGas execute_gas = 2 + [ (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"execute_gas\"" ]; + + // minimum_amount is a minimum amount for staking message cancel_unbonding_delegation + uint64 min_amount = 3 + [ (gogoproto.moretags) = "yaml:\"min_amount\"" ]; } + +// ExecuteGas defines the raw gas for the enqueued message execution. + message ExecuteGas { + option (gogoproto.equal) = true; + + uint64 delegate = 1 [(gogoproto.moretags) = "yaml:\"delegate\""]; + uint64 undelegate = 2 [(gogoproto.moretags) = "yaml:\"undelegate\""]; + uint64 begin_redelegate = 3 [(gogoproto.moretags) = "yaml:\"begin_redelegate\""]; + uint64 cancel_unbonding_delegation = 4 [(gogoproto.moretags) = "yaml:\"cancel_unbonding_delegation\""]; + uint64 edit_validator = 5 [(gogoproto.moretags) = "yaml:\"edit_validator\""]; + uint64 create_validator = 6 [(gogoproto.moretags) = "yaml:\"create_validator\""]; + } \ No newline at end of file diff --git a/babylon/finality/v1/finality.proto b/babylon/finality/v1/finality.proto index 3618fff..e035f58 100644 --- a/babylon/finality/v1/finality.proto +++ b/babylon/finality/v1/finality.proto @@ -26,31 +26,28 @@ message VotingPowerDistCache { // FinalityProviderDistInfo is the reward distribution of a finality provider // and its BTC delegations message FinalityProviderDistInfo { - // btc_pk is the Bitcoin secp256k1 PK of this finality provider - // the PK follows encoding in BIP-340 spec - bytes btc_pk = 1 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; - // addr is the bytes of the address to receive commission from delegations. - bytes addr = 2; - // commission defines the commission rate of finality provider - string commission = 3 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec" - ]; - // total_bonded_sat is the total amount of bonded BTC stake (in Satoshi) of - // the finality provider - uint64 total_bonded_sat = 4; - // is_timestamped indicates whether the finality provider - // has timestamped public randomness committed - // if no, it should not be assigned voting power - bool is_timestamped = 5; - // is_jailed indicates whether the finality provider - // is jailed, if so, it should not be assigned voting power - bool is_jailed = 6; - // is_slashed indicates whether the finality provider - // is slashed, if so, it should not be assigned voting power - bool is_slashed = 7; + // btc_pk is the Bitcoin secp256k1 PK of this finality provider + // the PK follows encoding in BIP-340 spec + bytes btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + // addr is the bytes of the address to receive commission from delegations. + bytes addr = 2; + // commission defines the commission rate of finality provider + string commission = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec" + ]; + // total_bonded_sat is the total amount of bonded BTC stake (in Satoshi) of the finality provider + uint64 total_bonded_sat = 4; + // is_timestamped indicates whether the finality provider + // has timestamped public randomness committed + // if no, it should not be assigned voting power + bool is_timestamped = 5; + // is_jailed indicates whether the finality provider + // is jailed, if so, it should not be assigned voting power + bool is_jailed = 6; + // is_slashed indicates whether the finality provider + // is slashed, if so, it should not be assigned voting power + bool is_slashed = 7; } // IndexedBlock is the necessary metadata and finalization status of a block @@ -92,54 +89,37 @@ message PubRandCommitIndexValue { // Evidence is the evidence that a finality provider has signed finality // signatures with correct public randomness on two conflicting Babylon headers message Evidence { - // fp_btc_pk is the BTC PK of the finality provider that casts this vote - bytes fp_btc_pk = 1 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; - // block_height is the height of the conflicting blocks - uint64 block_height = 2; - // pub_rand is the public randomness the finality provider has committed to - bytes pub_rand = 3 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.SchnorrPubRand" ]; - // canonical_app_hash is the AppHash of the canonical block - bytes canonical_app_hash = 4; - // fork_app_hash is the AppHash of the fork block - bytes fork_app_hash = 5; - // canonical_finality_sig is the finality signature to the canonical block - // where finality signature is an EOTS signature, i.e., - // the `s` in a Schnorr signature `(r, s)` - // `r` is the public randomness that is already committed by the finality - // provider - bytes canonical_finality_sig = 6 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.SchnorrEOTSSig" ]; - // fork_finality_sig is the finality signature to the fork block - // where finality signature is an EOTS signature - bytes fork_finality_sig = 7 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.SchnorrEOTSSig" ]; - // signing_context is the context in which the finality signatures were used. - // It must be hex encoded 32 bytes, of the sha256 hash of the context string - string signing_context = 8; + // fp_btc_pk is the BTC PK of the finality provider that casts this vote + bytes fp_btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + // block_height is the height of the conflicting blocks + uint64 block_height = 2; + // pub_rand is the public randomness the finality provider has committed to + bytes pub_rand = 3 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.SchnorrPubRand" ]; + // canonical_app_hash is the AppHash of the canonical block + bytes canonical_app_hash = 4; + // fork_app_hash is the AppHash of the fork block + bytes fork_app_hash = 5; + // canonical_finality_sig is the finality signature to the canonical block + // where finality signature is an EOTS signature, i.e., + // the `s` in a Schnorr signature `(r, s)` + // `r` is the public randomness that is already committed by the finality provider + bytes canonical_finality_sig = 6 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.SchnorrEOTSSig" ]; + // fork_finality_sig is the finality signature to the fork block + // where finality signature is an EOTS signature + bytes fork_finality_sig = 7 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.SchnorrEOTSSig" ]; } // FinalityProviderSigningInfo defines a finality provider's signing info for // monitoring their liveness activity. message FinalityProviderSigningInfo { - // fp_btc_pk is the BTC PK of the finality provider that casts this vote - bytes fp_btc_pk = 1 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; - // start_height is the block height at which finality provider become active - int64 start_height = 2; - // 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 - ]; + // fp_btc_pk is the BTC PK of the finality provider that casts this vote + bytes fp_btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + // start_height is the block height at which finality provider become active + int64 start_height = 2; + // 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/babylon/finality/v1/genesis.proto b/babylon/finality/v1/genesis.proto index fdcea08..32daafb 100644 --- a/babylon/finality/v1/genesis.proto +++ b/babylon/finality/v1/genesis.proto @@ -51,15 +51,11 @@ message GenesisState { message VoteSig { // block_height is the height of the voted block. uint64 block_height = 1; - // fp_btc_pk is the BTC PK of the finality provider that casts this vote - bytes fp_btc_pk = 2 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; - // finality_sig is the finality signature to this block - // where finality signature is an EOTS signature, i.e. - bytes finality_sig = 3 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.SchnorrEOTSSig" ]; + // fp_btc_pk is the BTC PK of the finality provider that casts this vote + bytes fp_btc_pk = 2 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + // finality_sig is the finality signature to this block + // where finality signature is an EOTS signature, i.e. + bytes finality_sig = 3 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.SchnorrEOTSSig" ]; } // PublicRandomness the block height and public randomness that the finality @@ -69,23 +65,16 @@ message PublicRandomness { // public randomness. uint64 block_height = 1; // fp_btc_pk is the BTC PK of the finality provider that casts this vote. - bytes fp_btc_pk = 2 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + bytes fp_btc_pk = 2 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; // pub_rand is the public randomness the finality provider has committed to. - bytes pub_rand = 3 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.SchnorrPubRand" ]; + bytes pub_rand = 3 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.SchnorrPubRand" ]; } // PubRandCommitWithPK is the public randomness commitment with the finality // provider's BTC public key message PubRandCommitWithPK { - // fp_btc_pk is the BTC PK of the finality provider that commits the public - // randomness - bytes fp_btc_pk = 1 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + // fp_btc_pk is the BTC PK of the finality provider that commits the public randomness + bytes fp_btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; // pub_rand_commit is the public randomness commitment PubRandCommit pub_rand_commit = 2; } @@ -107,9 +96,7 @@ message PubRandCommitIdx { // key. message SigningInfo { // fp_btc_pk is the BTC PK of the finality provider - bytes fp_btc_pk = 1 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + bytes fp_btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; // fp_signing_info represents the signing info of this finality provider. FinalityProviderSigningInfo fp_signing_info = 2 [ (gogoproto.nullable) = false ]; @@ -119,9 +106,7 @@ message SigningInfo { // BTC public key. message FinalityProviderMissedBlocks { // fp_btc_pk is the BTC PK of the finality provider - bytes fp_btc_pk = 1 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + bytes fp_btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; // missed_blocks is an array of missed blocks by the finality provider. repeated MissedBlock missed_blocks = 2 [ (gogoproto.nullable) = false ]; } @@ -140,11 +125,8 @@ message VotingPowerFP { // block_height is the height of the block the voting power was stored. uint64 block_height = 1; // fp_btc_pk the finality provider btc public key. - bytes fp_btc_pk = 2 - [ (gogoproto.customtype) = - "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; - // voting_power is the power of the finality provider at this specific block - // height. + bytes fp_btc_pk = 2 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.BIP340PubKey" ]; + // voting_power is the power of the finality provider at this specific block height. uint64 voting_power = 3; } diff --git a/babylon/finality/v1/query.proto b/babylon/finality/v1/query.proto index 0431eae..801aab4 100644 --- a/babylon/finality/v1/query.proto +++ b/babylon/finality/v1/query.proto @@ -326,9 +326,6 @@ message EvidenceResponse { // fork_finality_sig is the finality signature to the fork block // where finality signature is an EOTS signature bytes fork_finality_sig = 7 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/v4/types.SchnorrEOTSSig" ]; - // signing_context is the context in which the finality signatures were used. - // It must be hex encoded 32 bytes, of the sha256 hash of the context string - string signing_context = 8; } // QueryEvidenceResponse is the response type for the diff --git a/babylon/finality/v1/tx.proto b/babylon/finality/v1/tx.proto index 4324214..69a14f3 100644 --- a/babylon/finality/v1/tx.proto +++ b/babylon/finality/v1/tx.proto @@ -17,6 +17,7 @@ service Msg { rpc CommitPubRandList(MsgCommitPubRandList) returns (MsgCommitPubRandListResponse); // AddFinalitySig adds a finality signature to a given block rpc AddFinalitySig(MsgAddFinalitySig) returns (MsgAddFinalitySigResponse); + // 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 @@ -24,9 +25,6 @@ service Msg { rpc UnjailFinalityProvider(MsgUnjailFinalityProvider) returns (MsgUnjailFinalityProviderResponse); // ResumeFinalityProposal handles the proposal of resuming finality. rpc ResumeFinalityProposal(MsgResumeFinalityProposal) returns (MsgResumeFinalityProposalResponse); - // EquivocationEvidence handles the evidence of equivocation message sent from - // the finality gadget cw contract - rpc EquivocationEvidence(MsgEquivocationEvidence) returns (MsgEquivocationEvidenceResponse); } // MsgCommitPubRandList defines a message for committing a list of public randomness for EOTS @@ -108,37 +106,6 @@ message MsgUnjailFinalityProvider { // MsgUnjailFinalityProviderResponse defines the Msg/UnjailFinalityProvider response type message MsgUnjailFinalityProviderResponse {} -// MsgEquivocationEvidence is the message for handling evidence of equivocation -message MsgEquivocationEvidence { - option (cosmos.msg.v1.signer) = "signer"; - - string signer = 1; - // fp_btc_pk_hex is the BTC PK of the finality provider that casts this vote - string fp_btc_pk_hex = 2; - // block_height is the height of the conflicting blocks - uint64 block_height = 3; - // pub_rand_hex is the public randomness the finality provider has committed to - string pub_rand_hex = 4; - // canonical_app_hash_hex is the AppHash of the canonical block - string canonical_app_hash_hex = 5; - // fork_app_hash_hex is the AppHash of the fork block - string fork_app_hash_hex = 6; - // canonical_finality_sig_hex is the finality signature to the canonical block - // where finality signature is an EOTS signature, i.e., - // the `s` in a Schnorr signature `(r, s)` - // `r` is the public randomness that is already committed by the finality provider - string canonical_finality_sig_hex = 7; - // fork_finality_sig_hex is the finality signature to the fork block - // where finality signature is an EOTS signature - string fork_finality_sig_hex = 8; - // signing_context is the context in which the finality signatures were used. - // It must be hex encoded 32 bytes, of the sha256 hash of the context string - string signing_context = 9; -} - -// MsgEquivocationEvidenceResponse is the response for MsgEquivocationEvidence -message MsgEquivocationEvidenceResponse {} - // MsgResumeFinalityProposal is a governance proposal to resume finality from halting message MsgResumeFinalityProposal { option (cosmos.msg.v1.signer) = "authority"; diff --git a/babylon/incentive/events.proto b/babylon/incentive/events.proto index 0bf0c4a..d8be65a 100644 --- a/babylon/incentive/events.proto +++ b/babylon/incentive/events.proto @@ -8,9 +8,7 @@ option go_package = "github.com/babylonlabs-io/babylon/v4/x/incentive/types"; // EventsPowerUpdateAtHeight stores a slice of events happened at // some specific block height, indexed by the block height. -message EventsPowerUpdateAtHeight { - repeated EventPowerUpdate events = 1; -} +message EventsPowerUpdateAtHeight { repeated EventPowerUpdate events = 1; } // EventPowerUpdate is an event that affects voting power distribution // of BTC rewards, it is indexed by the babylon block height which @@ -25,13 +23,12 @@ message EventPowerUpdate { } } - // EventBTCDelegationActivated event that activated a BTC delegation. message EventBTCDelegationActivated { // FpAddr is the bbn address of the finality provider - string fp_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string fp_addr = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // BtcDelAddr is the bbn address of the BTC delegator - string btc_del_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string btc_del_addr = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // TotalSat the number of satoshis delegated bytes total_sat = 3 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -43,9 +40,9 @@ message EventBTCDelegationActivated { // EventBTCDelegationUnbonded event that unbonded a BTC delegation. message EventBTCDelegationUnbonded { // FpAddr is the bbn address of the finality provider - string fp_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string fp_addr = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // BtcDelAddr is the bbn address of the BTC delegator - string btc_del_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string btc_del_addr = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // TotalSat the number of satoshis unbonded withdraw bytes total_sat = 3 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -53,4 +50,3 @@ message EventBTCDelegationUnbonded { (gogoproto.nullable) = false ]; } - diff --git a/babylon/incentive/genesis.proto b/babylon/incentive/genesis.proto index f925896..e68f1df 100644 --- a/babylon/incentive/genesis.proto +++ b/babylon/incentive/genesis.proto @@ -41,13 +41,16 @@ message GenesisState { // finality providers to which it delegated some BTC repeated BTCDelegatorToFpEntry btc_delegators_to_fps = 9 [ (gogoproto.nullable) = false ]; - // EventRewardTracker stores the events that will be processed at the babylon block height - // prior to the BTC reward distribution. + // EventRewardTracker stores the events that will be processed at the babylon + // block height prior to the BTC reward distribution. repeated EventsPowerUpdateAtHeightEntry event_reward_tracker = 10 [ (gogoproto.nullable) = false ]; // LastProcessedHeightEventRewardTracker is the latest block height in which // the reward tracker was processed. uint64 last_processed_height_event_reward_tracker = 11; + // FP direct rewards gauge on every height + repeated FPDirectGaugeEntry fp_direct_gauges = 12 + [ (gogoproto.nullable) = false ]; } // BTCStakingGaugeEntry represents a gauge for BTC staking rewards at a specific @@ -59,6 +62,15 @@ message BTCStakingGaugeEntry { Gauge gauge = 2; } +// FPDirectGaugeEntry represents a gauge for FP direct rewards at a specific +// height. +message FPDirectGaugeEntry { + // Block height at which this gauge is set + uint64 height = 1; + // The gauge object storing rewards info + Gauge gauge = 2; +} + // RewardGaugeEntry represents a reward gauge for a specific stakeholder. message RewardGaugeEntry { // Type of stakeholder @@ -141,4 +153,6 @@ enum StakeholderType { FINALITY_PROVIDER = 0; // BTC staker stakeholder type BTC_STAKER = 1; + // Costaker stakeholder type + COSTAKER = 2; } \ No newline at end of file diff --git a/babylon/incentive/params.proto b/babylon/incentive/params.proto index 24c17a7..9a33acb 100644 --- a/babylon/incentive/params.proto +++ b/babylon/incentive/params.proto @@ -23,4 +23,12 @@ message Params { (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; + + // fp_portion is the percentage of fee_collector balance to collect each block + // and send to the finality providers reward gauge + string fp_portion = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } diff --git a/babylon/incentive/query.proto b/babylon/incentive/query.proto index 1ed8c60..497cfde 100644 --- a/babylon/incentive/query.proto +++ b/babylon/incentive/query.proto @@ -48,7 +48,8 @@ service Query { rpc FpCurrentRewards(QueryFpCurrentRewardsRequest) returns (QueryFpCurrentRewardsResponse) { option (google.api.http).get = - "/babylon/incentive/finality_providers_current_rewards/{finality_provider_address}"; + "/babylon/incentive/finality_providers_current_rewards/" + "{finality_provider_address}"; } } @@ -204,4 +205,4 @@ message QueryFpCurrentRewardsResponse { (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; -} +} \ No newline at end of file diff --git a/babylon/incentive/rewards.proto b/babylon/incentive/rewards.proto index 0b979ba..7957b54 100644 --- a/babylon/incentive/rewards.proto +++ b/babylon/incentive/rewards.proto @@ -41,10 +41,6 @@ message FinalityProviderCurrentRewards { // or btc rewards withdraw) a new period must be created, accumulate this // rewards to FinalityProviderHistoricalRewards with a new period and zero out // the Current Rewards. - // Note: This rewards have increased simulated decimals (10^20) to increase - // precision when calculating the rewards per satoshi and protect against - // math overflow issues. The decimals are removed prior to sending out - // to the incentive gauge. repeated cosmos.base.v1beta1.Coin current_rewards = 1 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" diff --git a/babylon/incentive/tx.proto b/babylon/incentive/tx.proto index c04872d..2da2816 100644 --- a/babylon/incentive/tx.proto +++ b/babylon/incentive/tx.proto @@ -19,13 +19,14 @@ service Msg { rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); // SetWithdrawAddress defines a method to change the withdraw address of a // stakeholder - rpc SetWithdrawAddress(MsgSetWithdrawAddress) returns (MsgSetWithdrawAddressResponse); + rpc SetWithdrawAddress(MsgSetWithdrawAddress) + returns (MsgSetWithdrawAddressResponse); } // MsgWithdrawReward defines a message for withdrawing reward of a stakeholder. message MsgWithdrawReward { option (cosmos.msg.v1.signer) = "address"; - // type is the stakeholder type {finality_provider, btc_staker} + // type is the stakeholder type {finality_provider, btc_staker, costaker} string type = 1; // address is the address of the stakeholder in bech32 string // signer of this msg has to be this address @@ -71,4 +72,3 @@ message MsgSetWithdrawAddress { // MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response // type. message MsgSetWithdrawAddressResponse {} - diff --git a/buf.lock b/buf.lock index 0ae231b..bdb2a63 100644 --- a/buf.lock +++ b/buf.lock @@ -16,16 +16,6 @@ deps: repository: gogo-proto commit: 34d970b699f84aa382f3c29773a60836 digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04 - - remote: buf.build - owner: cosmos - repository: ibc - commit: 857539074f9c4dda961f9db5dcf8e462 - digest: shake256:e8892cbffb31dd4daedda8dd293f224bc4b718b9854128a0dd35fdf984c8d4c31a006c49cc4bcdfb5d20782a6755f25eea8264f3674c83fcefd809d904102015 - - remote: buf.build - owner: cosmos - repository: ics23 - commit: 55085f7c710a45f58fa09947208eb70b - digest: shake256:9bf0bc495b5a11c88d163d39ef521bc4b00bc1374a05758c91d82821bdc61f09e8c2c51dda8452529bf80137f34d852561eacbe9550a59015d51cecb0dacb628 - remote: buf.build owner: googleapis repository: googleapis diff --git a/buf.yaml b/buf.yaml index 8bd914a..2db8cfc 100644 --- a/buf.yaml +++ b/buf.yaml @@ -5,13 +5,12 @@ deps: - buf.build/cosmos/cosmos-proto:1935555c206d4afb9e94615dfd0fad31 - buf.build/cosmos/gogo-proto:a14993478f40695898ed8a86931094b6656e8a5d - buf.build/googleapis/googleapis:8d7204855ec14631a499bd7393ce1970 - - buf.build/cosmos/ibc breaking: use: - FILE lint: use: - - STANDARD + - DEFAULT - COMMENTS - FILE_LOWER_SNAKE_CASE - COMMENT_MESSAGE diff --git a/cosmwasm/wasm/v1/query.proto b/cosmwasm/wasm/v1/query.proto index e52b6b0..614bbb2 100644 --- a/cosmwasm/wasm/v1/query.proto +++ b/cosmwasm/wasm/v1/query.proto @@ -101,7 +101,7 @@ service Query { rpc BuildAddress(QueryBuildAddressRequest) returns (QueryBuildAddressResponse) { option (cosmos.query.v1.module_query_safe) = true; - option (google.api.http).get = "/cosmwasm/wasm/v1/contract/build_address"; + option (google.api.http).get = "/cosmwasm/wasm/v1/build_address"; } } diff --git a/lavanet/lava/lavanet/lava/epochstorage/provider_metadata.proto b/lavanet/lava/lavanet/lava/epochstorage/provider_metadata.proto index ef50359..928a2b0 100644 --- a/lavanet/lava/lavanet/lava/epochstorage/provider_metadata.proto +++ b/lavanet/lava/lavanet/lava/epochstorage/provider_metadata.proto @@ -15,4 +15,5 @@ message ProviderMetadata { uint64 delegate_commission = 5; // delegation commission (precentage 0-100) uint64 last_change = 6; cosmos.staking.v1beta1.Description description = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + uint64 last_stake_move = 8; // timestamp of last stake move operation for rate limiting } \ No newline at end of file diff --git a/scripts/protoc-swagger-gen.sh b/scripts/protoc-swagger-gen.sh index b738a2c..3d80701 100644 --- a/scripts/protoc-swagger-gen.sh +++ b/scripts/protoc-swagger-gen.sh @@ -2,23 +2,22 @@ set -eo pipefail -mkdir -p ./tmp-swagger-gen +mkdir -p ./tmp-swagger-gen cd proto proto_dirs=$(find ./babylon -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) for dir in $proto_dirs; do - # generate OpenAPI v2 files (filter query files) + # generate swagger files (filter query files) query_file=$(find "${dir}" -maxdepth 1 \( -name 'query.proto' -o -name 'service.proto' \)) if [[ ! -z "$query_file" ]]; then - echo "Generating Swagger for $query_file" buf generate --template buf.gen.swagger.yaml $query_file - else - echo "No query or service proto file found in $dir" fi done cd .. -# combine OpenAPI v2 files +# combine swagger files +# uses nodejs package `swagger-combine`. +# all the individual swagger files need to be configured in `config.json` for merging swagger-combine ./client/docs/config.json -o ./client/docs/swagger-ui/swagger.yaml -f yaml --continueOnConflictingPaths true --includeDefinitions true -# clean OpenAPI v2 files -rm -rf ./tmp-swagger-gen \ No newline at end of file +# clean swagger files +rm -rf ./tmp-swagger-gen diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index d1f50fa..3af7304 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -24,4 +24,4 @@ cp -r github.com/babylonlabs-io/babylon/v4/* ./ rm -rf github.com go mod tidy -# go mod tidy -compat=1.23 +# go mod tidy -compat=1.23 \ No newline at end of file