diff --git a/CHANGELOG.md b/CHANGELOG.md index 02764ce54..b3ae47e40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [#305](https://github.com/babylonlabs-io/babylon/pull/305) chore: add more error logs to `VerifyInclusionProofAndGetHeight` - [#304](https://github.com/babylonlabs-io/babylon/pull/304) Add highest voted height to finality provider +### State Machine Breaking + +- [#310](https://github.com/babylonlabs-io/babylon/pull/310) implement adr-37 - +making params valid for btc light client ranges + ## v0.17.1 ### Bug fixes diff --git a/app/include_upgrade_mainnet.go b/app/include_upgrade_mainnet.go index 4d492254d..1a758e29a 100644 --- a/app/include_upgrade_mainnet.go +++ b/app/include_upgrade_mainnet.go @@ -11,7 +11,7 @@ import ( // init is used to include v1 upgrade for mainnet data func init() { Upgrades = []upgrades.Upgrade{v1.CreateUpgrade(v1.UpgradeDataString{ - BtcStakingParamStr: mainnet.BtcStakingParamStr, + BtcStakingParamsStr: mainnet.BtcStakingParamsStr, FinalityParamStr: mainnet.FinalityParamStr, IncentiveParamStr: mainnet.IncentiveParamStr, CosmWasmParamStr: mainnet.CosmWasmParamStr, diff --git a/app/include_upgrade_testnet.go b/app/include_upgrade_testnet.go index 15f974952..a465292a9 100644 --- a/app/include_upgrade_testnet.go +++ b/app/include_upgrade_testnet.go @@ -12,7 +12,7 @@ import ( // it is also used for e2e testing func init() { Upgrades = []upgrades.Upgrade{v1.CreateUpgrade(v1.UpgradeDataString{ - BtcStakingParamStr: testnet.BtcStakingParamStr, + BtcStakingParamsStr: testnet.BtcStakingParamsStr, FinalityParamStr: testnet.FinalityParamStr, IncentiveParamStr: testnet.IncentiveParamStr, CosmWasmParamStr: testnet.CosmWasmParamStr, diff --git a/app/upgrades/v1/data_params_test.go b/app/upgrades/v1/data_params_test.go index 01586760f..92941488e 100644 --- a/app/upgrades/v1/data_params_test.go +++ b/app/upgrades/v1/data_params_test.go @@ -3,19 +3,32 @@ package v1_test import ( "testing" + "cosmossdk.io/log" + "cosmossdk.io/store" + storemetrics "cosmossdk.io/store/metrics" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" "github.com/babylonlabs-io/babylon/app" v1 "github.com/babylonlabs-io/babylon/app/upgrades/v1" + testutilk "github.com/babylonlabs-io/babylon/testutil/keeper" ) func TestHardCodedBtcStakingParamsAreValid(t *testing.T) { - bbnApp := app.NewTmpBabylonApp() for _, upgradeData := range UpgradeV1Data { - params, err := v1.LoadBtcStakingParamsFromData(bbnApp.AppCodec(), upgradeData.BtcStakingParamStr) + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewTestLogger(t), storemetrics.NewNoOpMetrics()) + k, ctx := testutilk.BTCStakingKeeperWithStore(t, db, stateStore, nil, nil, nil) + + params, err := v1.LoadBtcStakingParamsFromData(upgradeData.BtcStakingParamsStr) require.NoError(t, err) - require.NoError(t, params.Validate()) + + for _, p := range params { + // using set Params here makes sure the parameters in the upgrade string are consistent + err = k.SetParams(ctx, p) + require.NoError(t, err) + } } } diff --git a/app/upgrades/v1/mainnet/btcstaking_params.go b/app/upgrades/v1/mainnet/btcstaking_params.go index da035c579..bbd738785 100644 --- a/app/upgrades/v1/mainnet/btcstaking_params.go +++ b/app/upgrades/v1/mainnet/btcstaking_params.go @@ -1,27 +1,28 @@ package mainnet -// TODO Some default parameters. Consider how to switch those depending on network: -// mainnet, testnet, devnet etc. -const BtcStakingParamStr = ` - { - "covenant_pks": [ - "43311589af63c2adda04fcd7792c038a05c12a4fe40351b3eb1612ff6b2e5a0e", - "d415b187c6e7ce9da46ac888d20df20737d6f16a41639e68ea055311e1535dd9", - "d27cd27dbff481bc6fc4aa39dd19405eb6010237784ecba13bab130a4a62df5d", - "a3e107fee8879f5cf901161dbf4ff61c252ba5fec6f6407fe81b9453d244c02c", - "c45753e856ad0abb06f68947604f11476c157d13b7efd54499eaa0f6918cf716" - ], - "covenant_quorum": 3, - "min_staking_value_sat": "1000", - "max_staking_value_sat": "10000000000", - "min_staking_time_blocks": 10, - "max_staking_time_blocks": 65535, - "slashing_pk_script": "dqkUAQEBAQEBAQEBAQEBAQEBAQEBAQGIrA==", - "min_slashing_tx_fee_sat": "1000", - "slashing_rate": "0.100000000000000000", - "min_unbonding_time_blocks": 0, - "unbonding_fee_sat": "1000", - "min_commission_rate": "0.03", - "delegation_creation_base_gas_fee": 1000, - "allow_list_expiration_height": 0 -}` +// TODO Some default parameters +const BtcStakingParamsStr = `[ + { + "covenant_pks": [ + "43311589af63c2adda04fcd7792c038a05c12a4fe40351b3eb1612ff6b2e5a0e", + "d415b187c6e7ce9da46ac888d20df20737d6f16a41639e68ea055311e1535dd9", + "d27cd27dbff481bc6fc4aa39dd19405eb6010237784ecba13bab130a4a62df5d", + "a3e107fee8879f5cf901161dbf4ff61c252ba5fec6f6407fe81b9453d244c02c", + "c45753e856ad0abb06f68947604f11476c157d13b7efd54499eaa0f6918cf716" + ], + "covenant_quorum": 3, + "min_staking_value_sat": 1000, + "max_staking_value_sat": 10000000000, + "min_staking_time_blocks": 10, + "max_staking_time_blocks": 65535, + "slashing_pk_script": "dqkUAQEBAQEBAQEBAQEBAQEBAQEBAQGIrA==", + "min_slashing_tx_fee_sat": 1000, + "slashing_rate": "0.100000000000000000", + "min_unbonding_time_blocks": 0, + "unbonding_fee_sat": 1000, + "min_commission_rate": "0.03", + "delegation_creation_base_gas_fee": 1000, + "allow_list_expiration_height": 0, + "btc_activation_height": 100 + } +]` diff --git a/app/upgrades/v1/testnet/btcstaking_params.go b/app/upgrades/v1/testnet/btcstaking_params.go index a83dabacc..1a97b556f 100644 --- a/app/upgrades/v1/testnet/btcstaking_params.go +++ b/app/upgrades/v1/testnet/btcstaking_params.go @@ -1,27 +1,73 @@ package testnet -// TODO Some default parameters. Consider how to switch those depending on network: -// mainnet, testnet, devnet etc. -const BtcStakingParamStr = ` - { - "covenant_pks": [ - "43311589af63c2adda04fcd7792c038a05c12a4fe40351b3eb1612ff6b2e5a0e", - "d415b187c6e7ce9da46ac888d20df20737d6f16a41639e68ea055311e1535dd9", - "d27cd27dbff481bc6fc4aa39dd19405eb6010237784ecba13bab130a4a62df5d", - "a3e107fee8879f5cf901161dbf4ff61c252ba5fec6f6407fe81b9453d244c02c", - "c45753e856ad0abb06f68947604f11476c157d13b7efd54499eaa0f6918cf716" - ], - "covenant_quorum": 3, - "min_staking_value_sat": "1000", - "max_staking_value_sat": "10000000000", - "min_staking_time_blocks": 10, - "max_staking_time_blocks": 65535, - "slashing_pk_script": "dqkUAQEBAQEBAQEBAQEBAQEBAQEBAQGIrA==", - "min_slashing_tx_fee_sat": "1000", - "slashing_rate": "0.100000000000000000", - "min_unbonding_time_blocks": 0, - "unbonding_fee_sat": "1000", - "min_commission_rate": "0.03", - "delegation_creation_base_gas_fee": 1000, - "allow_list_expiration_height": 0 -}` +const BtcStakingParamsStr = `[ + { + "covenant_pks": [ + "43311589af63c2adda04fcd7792c038a05c12a4fe40351b3eb1612ff6b2e5a0e", + "d415b187c6e7ce9da46ac888d20df20737d6f16a41639e68ea055311e1535dd9", + "d27cd27dbff481bc6fc4aa39dd19405eb6010237784ecba13bab130a4a62df5d", + "a3e107fee8879f5cf901161dbf4ff61c252ba5fec6f6407fe81b9453d244c02c", + "c45753e856ad0abb06f68947604f11476c157d13b7efd54499eaa0f6918cf716" + ], + "covenant_quorum": 3, + "min_staking_value_sat": 1000, + "max_staking_value_sat": 10000000000, + "min_staking_time_blocks": 10, + "max_staking_time_blocks": 65535, + "slashing_pk_script": "dqkUAQEBAQEBAQEBAQEBAQEBAQEBAQGIrA==", + "min_slashing_tx_fee_sat": 1000, + "slashing_rate": "0.100000000000000000", + "min_unbonding_time_blocks": 0, + "unbonding_fee_sat": 1000, + "min_commission_rate": "0.03", + "delegation_creation_base_gas_fee": 1000, + "allow_list_expiration_height": 0, + "btc_activation_height": 100 + }, + { + "covenant_pks": [ + "43311589af63c2adda04fcd7792c038a05c12a4fe40351b3eb1612ff6b2e5a0e", + "d415b187c6e7ce9da46ac888d20df20737d6f16a41639e68ea055311e1535dd9", + "d27cd27dbff481bc6fc4aa39dd19405eb6010237784ecba13bab130a4a62df5d", + "a3e107fee8879f5cf901161dbf4ff61c252ba5fec6f6407fe81b9453d244c02c", + "c45753e856ad0abb06f68947604f11476c157d13b7efd54499eaa0f6918cf716" + ], + "covenant_quorum": 3, + "min_staking_value_sat": 1000, + "max_staking_value_sat": 10000000000, + "min_staking_time_blocks": 10, + "max_staking_time_blocks": 65535, + "slashing_pk_script": "dqkUAQEBAQEBAQEBAQEBAQEBAQEBAQGIrA==", + "min_slashing_tx_fee_sat": 1000, + "slashing_rate": "0.100000000000000000", + "min_unbonding_time_blocks": 0, + "unbonding_fee_sat": 1000, + "min_commission_rate": "0.03", + "delegation_creation_base_gas_fee": 1000, + "allow_list_expiration_height": 0, + "btc_activation_height": 150 + }, + { + "covenant_pks": [ + "43311589af63c2adda04fcd7792c038a05c12a4fe40351b3eb1612ff6b2e5a0e", + "d415b187c6e7ce9da46ac888d20df20737d6f16a41639e68ea055311e1535dd9", + "d27cd27dbff481bc6fc4aa39dd19405eb6010237784ecba13bab130a4a62df5d", + "a3e107fee8879f5cf901161dbf4ff61c252ba5fec6f6407fe81b9453d244c02c", + "c45753e856ad0abb06f68947604f11476c157d13b7efd54499eaa0f6918cf716" + ], + "covenant_quorum": 3, + "min_staking_value_sat": 1000, + "max_staking_value_sat": 10000000000, + "min_staking_time_blocks": 10, + "max_staking_time_blocks": 65535, + "slashing_pk_script": "dqkUAQEBAQEBAQEBAQEBAQEBAQEBAQGIrA==", + "min_slashing_tx_fee_sat": 1000, + "slashing_rate": "0.100000000000000000", + "min_unbonding_time_blocks": 0, + "unbonding_fee_sat": 1000, + "min_commission_rate": "0.03", + "delegation_creation_base_gas_fee": 1000, + "allow_list_expiration_height": 0, + "btc_activation_height": 128 + } +]` diff --git a/app/upgrades/v1/types.go b/app/upgrades/v1/types.go index d4a46f783..edeb36c29 100644 --- a/app/upgrades/v1/types.go +++ b/app/upgrades/v1/types.go @@ -1,7 +1,7 @@ package v1 type UpgradeDataString struct { - BtcStakingParamStr string + BtcStakingParamsStr string FinalityParamStr string IncentiveParamStr string CosmWasmParamStr string diff --git a/app/upgrades/v1/upgrades.go b/app/upgrades/v1/upgrades.go index 69995905a..250c97ab8 100644 --- a/app/upgrades/v1/upgrades.go +++ b/app/upgrades/v1/upgrades.go @@ -9,6 +9,7 @@ import ( "encoding/json" "errors" "fmt" + "sort" sdkmath "cosmossdk.io/math" store "cosmossdk.io/store/types" @@ -87,7 +88,7 @@ func CreateUpgradeHandler(upgradeDataStr UpgradeDataString) upgrades.UpgradeHand &keepers.FinalityKeeper, &keepers.IncentiveKeeper, &keepers.WasmKeeper, - upgradeDataStr.BtcStakingParamStr, + upgradeDataStr.BtcStakingParamsStr, upgradeDataStr.FinalityParamStr, upgradeDataStr.IncentiveParamStr, upgradeDataStr.CosmWasmParamStr, @@ -142,7 +143,7 @@ func upgradeParameters( btcStakingParam, finalityParam, incentiveParam, wasmParam string, ) error { // Upgrade the staking parameters as first, as other upgrades depend on it. - if err := upgradeBtcStakingParameters(ctx, cdc, btcK, btcStakingParam); err != nil { + if err := upgradeBtcStakingParameters(ctx, btcK, btcStakingParam); err != nil { return fmt.Errorf("failed to upgrade btc staking parameters: %w", err) } if err := upgradeFinalityParameters(ctx, cdc, finK, finalityParam); err != nil { @@ -189,18 +190,22 @@ func upgradeCosmWasmParameters( func upgradeBtcStakingParameters( ctx sdk.Context, - cdc codec.Codec, k *btcstkkeeper.Keeper, btcStakingParam string, ) error { - params, err := LoadBtcStakingParamsFromData(cdc, btcStakingParam) + // params should be already sorted by their btc activation + // block height in ascending order + params, err := LoadBtcStakingParamsFromData(btcStakingParam) if err != nil { return err } - // We are overwriting the params at version 0, as the upgrade is happening from - // TGE chain so there should be only one version of the params - return k.OverwriteParamsAtVersion(ctx, 0, params) + for version, p := range params { + if err := k.OverwriteParamsAtVersion(ctx, uint32(version), p); err != nil { + return err + } + } + return nil } func upgradeFinalityParameters( @@ -295,15 +300,20 @@ func upgradeBTCHeaders(ctx sdk.Context, cdc codec.Codec, btcLigthK *btclightkeep return insertBtcHeaders(ctx, btcLigthK, newHeaders) } -func LoadBtcStakingParamsFromData(cdc codec.Codec, data string) (btcstktypes.Params, error) { +func LoadBtcStakingParamsFromData(data string) ([]btcstktypes.Params, error) { buff := bytes.NewBufferString(data) - var params btcstktypes.Params - err := cdc.UnmarshalJSON(buff.Bytes(), ¶ms) + var params []btcstktypes.Params + err := json.Unmarshal(buff.Bytes(), ¶ms) if err != nil { - return btcstktypes.Params{}, err + return []btcstktypes.Params{}, err } + // sort params by the BTC activation height ascending order 100, 150, 200... + sort.Slice(params, func(i, j int) bool { + return params[i].BtcActivationHeight < params[j].BtcActivationHeight + }) + return params, nil } diff --git a/app/upgrades/v1/upgrades_test.go b/app/upgrades/v1/upgrades_test.go index 3960ebc5d..96ff160b9 100644 --- a/app/upgrades/v1/upgrades_test.go +++ b/app/upgrades/v1/upgrades_test.go @@ -46,7 +46,7 @@ var ( wasmContract []byte UpgradeV1DataTestnet = v1.UpgradeDataString{ - BtcStakingParamStr: testnetdata.BtcStakingParamStr, + BtcStakingParamsStr: testnetdata.BtcStakingParamsStr, FinalityParamStr: testnetdata.FinalityParamStr, IncentiveParamStr: testnetdata.IncentiveParamStr, CosmWasmParamStr: testnetdata.CosmWasmParamStr, @@ -55,7 +55,7 @@ var ( AllowedStakingTxHashesStr: testnetdata.AllowedStakingTxHashesStr, } UpgradeV1DataMainnet = v1.UpgradeDataString{ - BtcStakingParamStr: mainnetdata.BtcStakingParamStr, + BtcStakingParamsStr: mainnetdata.BtcStakingParamsStr, FinalityParamStr: mainnetdata.FinalityParamStr, IncentiveParamStr: mainnetdata.IncentiveParamStr, CosmWasmParamStr: mainnetdata.CosmWasmParamStr, @@ -203,7 +203,7 @@ func (s *UpgradeTestSuite) PreUpgrade() { s.btcHeadersLenPreUpgrade = len(allBtcHeaders) // Before upgrade, the params should be different - bsParamsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.app.AppCodec(), s.upgradeDataStr.BtcStakingParamStr) + bsParamsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.upgradeDataStr.BtcStakingParamsStr) s.NoError(err) bsModuleParams := s.app.BTCStakingKeeper.GetParams(s.ctx) s.NotEqualValues(bsModuleParams, bsParamsFromUpgrade) @@ -277,10 +277,20 @@ func (s *UpgradeTestSuite) PostUpgrade() { } // After upgrade, the params should be the same - bsParamsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.app.AppCodec(), s.upgradeDataStr.BtcStakingParamStr) + bsParamsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.upgradeDataStr.BtcStakingParamsStr) s.NoError(err) + bsModuleParams := s.app.BTCStakingKeeper.GetParams(s.ctx) - s.EqualValues(bsModuleParams, bsParamsFromUpgrade) + lastParamInUpgradeData := bsParamsFromUpgrade[len(bsParamsFromUpgrade)-1] + s.EqualValues(bsModuleParams, lastParamInUpgradeData) + + for expVersion, paramsInUpgradeData := range bsParamsFromUpgrade { + bsParamsAtBtcHeight, version, err := s.app.BTCStakingKeeper.GetParamsForBtcHeight(s.ctx, uint64(paramsInUpgradeData.BtcActivationHeight)) + s.NoError(err) + s.Equal(uint32(expVersion), version) + s.Equal(*bsParamsAtBtcHeight, paramsInUpgradeData) + } + fParamsFromUpgrade, err := v1.LoadFinalityParamsFromData(s.app.AppCodec(), s.upgradeDataStr.FinalityParamStr) s.NoError(err) fModuleParams := s.app.FinalityKeeper.GetParams(s.ctx) diff --git a/proto/babylon/btcstaking/v1/params.proto b/proto/babylon/btcstaking/v1/params.proto index 862a3756d..bd282def8 100644 --- a/proto/babylon/btcstaking/v1/params.proto +++ b/proto/babylon/btcstaking/v1/params.proto @@ -59,6 +59,22 @@ message Params { // i.e all staking transactions are allowed to enter Babylon chain afterwards // 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; +} + +// HeightVersionPair pairs a btc height with a version of the parameters +message HeightVersionPair { + // start_height is the height from which the parameters are activated (inclusive) + uint64 start_height = 1; + // version is the version of the parameters + uint32 version = 2; +} + +// HeightToVersionMap maps a btc height to a version of the parameters +message HeightToVersionMap { + // Pairs must be sorted by `start_height` in ascending order, without duplicates + repeated HeightVersionPair pairs = 1; } // StoredParams attach information about the version of stored parameters diff --git a/proto/babylon/btcstaking/v1/query.proto b/proto/babylon/btcstaking/v1/query.proto index 389da8e1c..184b8a840 100644 --- a/proto/babylon/btcstaking/v1/query.proto +++ b/proto/babylon/btcstaking/v1/query.proto @@ -23,6 +23,11 @@ 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}"; + } + // FinalityProviders queries all finality providers rpc FinalityProviders(QueryFinalityProvidersRequest) returns (QueryFinalityProvidersResponse) { option (google.api.http).get = "/babylon/btcstaking/v1/finality_providers"; @@ -69,6 +74,20 @@ message QueryParamsByVersionResponse { Params params = 1 [(gogoproto.nullable) = false]; } +// 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. +message QueryParamsByBTCHeightResponse { + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false]; + + // version is the version of the params for the given BTC height + uint32 version = 2; +} + // QueryFinalityProvidersRequest is the request type for the // Query/FinalityProviders RPC method. message QueryFinalityProvidersRequest { diff --git a/test/e2e/configurer/chain/queries_btcstaking.go b/test/e2e/configurer/chain/queries_btcstaking.go index 149b8a76b..cff41ecee 100644 --- a/test/e2e/configurer/chain/queries_btcstaking.go +++ b/test/e2e/configurer/chain/queries_btcstaking.go @@ -23,6 +23,18 @@ func (n *NodeConfig) QueryBTCStakingParams() *bstypes.Params { return &resp.Params } +func (n *NodeConfig) QueryBTCStakingParamsByVersion(version uint32) *bstypes.Params { + path := fmt.Sprintf("/babylon/btcstaking/v1/params/%d", version) + bz, err := n.QueryGRPCGateway(path, url.Values{}) + require.NoError(n.t, err) + + var resp bstypes.QueryParamsByVersionResponse + err = util.Cdc.UnmarshalJSON(bz, &resp) + require.NoError(n.t, err) + + return &resp.Params +} + func (n *NodeConfig) QueryFinalityParams() *ftypes.Params { bz, err := n.QueryGRPCGateway("/babylon/finality/v1/params", 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_v1_test.go similarity index 92% rename from test/e2e/software_upgrade_e2e_signet_launch_test.go rename to test/e2e/software_upgrade_e2e_v1_test.go index 4932b9658..88ce22d3e 100644 --- a/test/e2e/software_upgrade_e2e_signet_launch_test.go +++ b/test/e2e/software_upgrade_e2e_v1_test.go @@ -94,8 +94,8 @@ func (s *SoftwareUpgradeV1TestnetTestSuite) TearDownSuite() { } } -// TestUpgradeSignetLaunch Checks if the BTC Headers were inserted. -func (s *SoftwareUpgradeV1TestnetTestSuite) TestUpgradeSignetLaunch() { +// TestUpgradeV1 Checks if the BTC Headers were inserted. +func (s *SoftwareUpgradeV1TestnetTestSuite) TestUpgradeV1() { // chain is already upgraded, only checks for differences in state are expected chainA := s.configurer.GetChainConfig(0) @@ -145,10 +145,17 @@ func (s *SoftwareUpgradeV1TestnetTestSuite) TestUpgradeSignetLaunch() { // as the one from the data stakingParams := n.QueryBTCStakingParams() - stakingParamsFromData, err := v1.LoadBtcStakingParamsFromData(bbnApp.AppCodec(), testnet.BtcStakingParamStr) + bsParamsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(testnet.BtcStakingParamsStr) s.NoError(err) - s.EqualValues(stakingParamsFromData, *stakingParams) + lastParamInUpgradeData := bsParamsFromUpgrade[len(bsParamsFromUpgrade)-1] + s.EqualValues(lastParamInUpgradeData, *stakingParams) + + // expected version starts at 0 since the upgrade overwrites the params + for expVersion, paramsInUpgradeData := range bsParamsFromUpgrade { + bsParamsAtBtcHeight := n.QueryBTCStakingParamsByVersion(uint32(expVersion)) + s.Equal(*bsParamsAtBtcHeight, paramsInUpgradeData) + } // check that finality params correctly deserialize and that they are the same // as the one from the data diff --git a/testutil/btcstaking-helper/keeper.go b/testutil/btcstaking-helper/keeper.go index e680c2b1a..6c48596d5 100644 --- a/testutil/btcstaking-helper/keeper.go +++ b/testutil/btcstaking-helper/keeper.go @@ -168,6 +168,7 @@ func (h *Helper) GenAndApplyCustomParams( MinUnbondingTimeBlocks: minUnbondingTime, UnbondingFeeSat: 1000, AllowListExpirationHeight: allowListExpirationHeight, + BtcActivationHeight: 1, }) h.NoError(err) return covenantSKs, covenantPKs @@ -217,6 +218,26 @@ func (h *Helper) CreateDelegation( unbondingTime uint16, usePreApproval bool, addToAllowList bool, +) (string, *types.MsgCreateBTCDelegation, *types.BTCDelegation, *btclctypes.BTCHeaderInfo, *types.InclusionProof, *UnbondingTxInfo, error) { + return h.CreateDelegationWithBtcBlockHeight( + r, delSK, fpPK, changeAddress, stakingValue, + stakingTime, unbondingValue, unbondingTime, + usePreApproval, addToAllowList, 10, + ) +} + +func (h *Helper) CreateDelegationWithBtcBlockHeight( + r *rand.Rand, + delSK *btcec.PrivateKey, + fpPK *btcec.PublicKey, + changeAddress string, + stakingValue int64, + stakingTime uint16, + unbondingValue int64, + unbondingTime uint16, + usePreApproval bool, + addToAllowList bool, + btcBlockHeight uint32, ) (string, *types.MsgCreateBTCDelegation, *types.BTCDelegation, *btclctypes.BTCHeaderInfo, *types.InclusionProof, *UnbondingTxInfo, error) { stakingTimeBlocks := stakingTime bsParams := h.BTCStakingKeeper.GetParams(h.Ctx) @@ -261,7 +282,7 @@ func (h *Helper) CreateDelegation( prevBlock, _ := datagen.GenRandomBtcdBlock(r, 0, nil) btcHeaderWithProof := datagen.CreateBlockWithTransaction(r, &prevBlock.Header, testStakingInfo.StakingTx) btcHeader := btcHeaderWithProof.HeaderBytes - btcHeaderInfo := &btclctypes.BTCHeaderInfo{Header: &btcHeader, Height: 10} + btcHeaderInfo := &btclctypes.BTCHeaderInfo{Header: &btcHeader, Height: btcBlockHeight} serializedStakingTx, err := bbn.SerializeBTCTx(testStakingInfo.StakingTx) h.NoError(err) diff --git a/testutil/datagen/datagen.go b/testutil/datagen/datagen.go index d38fdf18d..fcc096212 100644 --- a/testutil/datagen/datagen.go +++ b/testutil/datagen/datagen.go @@ -24,6 +24,10 @@ func RandomInt(r *rand.Rand, rng int) uint64 { return uint64(r.Intn(rng)) } +func RandomUInt32(r *rand.Rand, rng uint32) uint32 { + return uint32(r.Intn(int(rng))) +} + func RandomIntOtherThan(r *rand.Rand, x int, rng int) uint64 { if rng == 1 && x == 0 { panic("There is no other int") diff --git a/x/btcstaking/genesis_test.go b/x/btcstaking/genesis_test.go index 2ab7d793c..8f1c29d52 100644 --- a/x/btcstaking/genesis_test.go +++ b/x/btcstaking/genesis_test.go @@ -3,12 +3,15 @@ package btcstaking_test import ( "testing" - "github.com/stretchr/testify/require" - + "cosmossdk.io/log" + "cosmossdk.io/store" + storemetrics "cosmossdk.io/store/metrics" keepertest "github.com/babylonlabs-io/babylon/testutil/keeper" "github.com/babylonlabs-io/babylon/testutil/nullify" "github.com/babylonlabs-io/babylon/x/btcstaking" "github.com/babylonlabs-io/babylon/x/btcstaking/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/stretchr/testify/require" ) func TestGenesis(t *testing.T) { @@ -16,8 +19,10 @@ func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: []*types.Params{&p}, } + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewTestLogger(t), storemetrics.NewNoOpMetrics()) + k, ctx := keepertest.BTCStakingKeeperWithStore(t, db, stateStore, nil, nil, nil) - k, ctx := keepertest.BTCStakingKeeper(t, nil, nil, nil) btcstaking.InitGenesis(ctx, *k, genesisState) got := btcstaking.ExportGenesis(ctx, *k) require.NotNil(t, got) diff --git a/x/btcstaking/keeper/genesis_test.go b/x/btcstaking/keeper/genesis_test.go index 72f1cd36b..574cb87c2 100644 --- a/x/btcstaking/keeper/genesis_test.go +++ b/x/btcstaking/keeper/genesis_test.go @@ -6,14 +6,38 @@ import ( "strings" "testing" + "cosmossdk.io/log" + "cosmossdk.io/store" + storemetrics "cosmossdk.io/store/metrics" + dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" + v1 "github.com/babylonlabs-io/babylon/app/upgrades/v1" + testnetdata "github.com/babylonlabs-io/babylon/app/upgrades/v1/testnet" "github.com/babylonlabs-io/babylon/testutil/datagen" "github.com/babylonlabs-io/babylon/testutil/helper" + testutilk "github.com/babylonlabs-io/babylon/testutil/keeper" btclightclientt "github.com/babylonlabs-io/babylon/x/btclightclient/types" "github.com/babylonlabs-io/babylon/x/btcstaking/types" ) +func TestInitGenesisWithSetParams(t *testing.T) { + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewTestLogger(t), storemetrics.NewNoOpMetrics()) + k, ctx := testutilk.BTCStakingKeeperWithStore(t, db, stateStore, nil, nil, nil) + + err := k.InitGenesis(ctx, *types.DefaultGenesis()) + require.NoError(t, err) + + params, err := v1.LoadBtcStakingParamsFromData(testnetdata.BtcStakingParamsStr) + require.NoError(t, err) + + for _, p := range params { + err = k.SetParams(ctx, p) + require.NoError(t, err) + } +} + func TestExportGenesis(t *testing.T) { r, h := rand.New(rand.NewSource(11)), helper.NewHelper(t) k, btclcK, ctx := h.App.BTCStakingKeeper, h.App.BTCLightClientKeeper, h.Ctx diff --git a/x/btcstaking/keeper/msg_server.go b/x/btcstaking/keeper/msg_server.go index f1e2465db..149841fd4 100644 --- a/x/btcstaking/keeper/msg_server.go +++ b/x/btcstaking/keeper/msg_server.go @@ -154,8 +154,6 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre ctx := sdk.UnwrapSDKContext(goCtx) - vp := ms.GetParamsWithVersion(ctx) - // 1. Parse the message into better domain format parsedMsg, err := types.ParseCreateDelegationMessage(req) @@ -190,6 +188,9 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre } } + // get latest params with version + vp := ms.GetParamsWithVersion(ctx) + // 5. if allow list is enabled we need to check whether staking transactions hash // is in the allow list if ms.isAllowListEnabled(ctx, &vp.Params) { @@ -198,17 +199,12 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre } } - // 6. Validate parsed message against parameters - paramsValidationResult, err := types.ValidateParsedMessageAgainstTheParams(parsedMsg, &vp.Params, ms.btcNet) - - if err != nil { - return nil, err - } - - // 7. If the delegation contains the inclusion proof, we need to verify the proof - // and set start height and end height + // 6. If the delegation contains the inclusion proof, we need to verify the proof + // and set start height and end height. We also need to validate delegation + // against correct parameters version btccParams := ms.btccKeeper.GetParams(ctx) - var startHeight, endHeight uint32 + var pvr *types.ParamsValidationResult + var paramsVersion, startHeight, endHeight uint32 if parsedMsg.StakingTxProofOfInclusion != nil { timeInfo, err := ms.VerifyInclusionProofAndGetHeight( ctx, @@ -221,15 +217,43 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre return nil, fmt.Errorf("invalid inclusion proof: %w", err) } + // staking transaction is already included in BTC chain, retrieve parameters + // based on the btc light client height + paramsByHeight, version, err := ms.GetParamsForBtcHeight(ctx, uint64(timeInfo.StartHeight)) + if err != nil { + // this error can happen if we receive delegations which is included before + // first activation height we support + return nil, err + } + + paramsValidationResult, err := types.ValidateParsedMessageAgainstTheParams(parsedMsg, paramsByHeight, ms.btcNet) + + if err != nil { + return nil, err + } + + pvr = paramsValidationResult startHeight = timeInfo.StartHeight endHeight = timeInfo.EndHeight + paramsVersion = version } else { + // this is delegation that is not included in BTC chain yet, we need to validate + // it against the latest parameters + paramsValidationResult, err := types.ValidateParsedMessageAgainstTheParams(parsedMsg, &vp.Params, ms.btcNet) + + if err != nil { + return nil, err + } + + pvr = paramsValidationResult + paramsVersion = vp.Version + // NOTE: here we consume more gas to protect Babylon chain and covenant members against spamming // i.e creating delegation that will never reach BTC ctx.GasMeter().ConsumeGas(vp.Params.DelegationCreationBaseGasFee, "delegation creation fee") } - // 8.all good, construct BTCDelegation and insert BTC delegation + // 7.all good, construct BTCDelegation and insert BTC delegation // NOTE: the BTC delegation does not have voting power yet. It will // have voting power only when it receives a covenant signatures newBTCDel := &types.BTCDelegation{ @@ -242,7 +266,7 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre EndHeight: endHeight, TotalSat: uint64(parsedMsg.StakingValue), StakingTx: parsedMsg.StakingTx.TransactionBytes, - StakingOutputIdx: paramsValidationResult.StakingOutputIdx, + StakingOutputIdx: pvr.StakingOutputIdx, SlashingTx: types.NewBtcSlashingTxFromBytes(parsedMsg.StakingSlashingTx.TransactionBytes), DelegatorSig: parsedMsg.StakerStakingSlashingTxSig.BIP340Signature, UnbondingTime: uint32(parsedMsg.UnbondingTime), @@ -255,7 +279,7 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre CovenantUnbondingSigList: nil, // NOTE: covenant signature will be submitted in a separate msg by covenant DelegatorUnbondingInfo: nil, }, - ParamsVersion: vp.Version, // version of the params against delegations was validated + ParamsVersion: paramsVersion, // version of the params against which delegation was validated } // add this BTC delegation, and emit corresponding events diff --git a/x/btcstaking/keeper/msg_server_test.go b/x/btcstaking/keeper/msg_server_test.go index 39dc6fb6e..cb8b79bd8 100644 --- a/x/btcstaking/keeper/msg_server_test.go +++ b/x/btcstaking/keeper/msg_server_test.go @@ -49,6 +49,7 @@ func FuzzMsgServer_UpdateParams(f *testing.F) { params := h.BTCStakingKeeper.GetParams(h.Ctx) ckptFinalizationTimeout := btccKeeper.GetParams(h.Ctx).CheckpointFinalizationTimeout params.MinUnbondingTimeBlocks = uint32(r.Intn(int(ckptFinalizationTimeout))) + 1 + params.BtcActivationHeight = params.BtcActivationHeight + 1 // Try to update params with minUnbondingTime less than or equal to checkpointFinalizationTimeout msg := &types.MsgUpdateParams{ @@ -241,6 +242,75 @@ func FuzzCreateBTCDelegation(f *testing.F) { }) } +func FuzzCreateBTCDelegationWithParamsFromBtcHeight(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 10) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(time.Now().Unix())) + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + // mock BTC light client and BTC checkpoint modules + btclcKeeper := types.NewMockBTCLightClientKeeper(ctrl) + btccKeeper := types.NewMockBtcCheckpointKeeper(ctrl) + h := testutil.NewHelper(t, btclcKeeper, btccKeeper) + + // set all parameters + h.GenAndApplyParams(r) + ctx, k := h.Ctx, h.BTCStakingKeeper + + versionedParams := k.GetParamsWithVersion(ctx) + currentParams := versionedParams.Params + + maxGapBlocksBetweenParams := datagen.RandomUInt32(r, 100) + 100 + expectedParamsBlockHeight := datagen.RandomUInt32(r, maxGapBlocksBetweenParams) + currentParams.BtcActivationHeight + 1 + expectedParamsVersion := versionedParams.Version + 1 + + currentParams.BtcActivationHeight = expectedParamsBlockHeight + err := k.SetParams(ctx, currentParams) + require.NoError(t, err) + + nextBtcActivationHeight := datagen.RandomUInt32(r, maxGapBlocksBetweenParams) + currentParams.BtcActivationHeight + 1 + currentParams.BtcActivationHeight = nextBtcActivationHeight + err = k.SetParams(ctx, currentParams) + require.NoError(t, err) + + // makes sure that at the BTC block height 300 will use the expected param + p, version, err := k.GetParamsForBtcHeight(ctx, uint64(nextBtcActivationHeight-1)) + h.NoError(err) + require.Equal(t, p.BtcActivationHeight, expectedParamsBlockHeight) + require.Equal(t, version, expectedParamsVersion) + + // creates one BTC delegation with BTC block height between expectedParamsBlockHeight and 500 + changeAddress, err := datagen.GenRandomBTCAddress(r, h.Net) + h.NoError(err) + + // generate and insert new finality provider + _, fpPK, _ := h.CreateFinalityProvider(r) + + btcBlockHeight := datagen.RandomUInt32(r, nextBtcActivationHeight-expectedParamsBlockHeight) + expectedParamsBlockHeight + // generate and insert new BTC delegation + stakingValue := int64(2 * 10e8) + delSK, _, err := datagen.GenRandomBTCKeyPair(r) + h.NoError(err) + _, _, btcDel, _, _, _, err := h.CreateDelegationWithBtcBlockHeight( + r, + delSK, + fpPK, + changeAddress.EncodeAddress(), + stakingValue, + 1000, + 0, + 0, + false, + false, + btcBlockHeight, + ) + h.NoError(err) + require.NotNil(t, btcDel.ParamsVersion, expectedParamsVersion) + }) +} + func TestProperVersionInDelegation(t *testing.T) { r := rand.New(rand.NewSource(time.Now().Unix())) ctrl := gomock.NewController(t) @@ -291,6 +361,7 @@ func TestProperVersionInDelegation(t *testing.T) { customMinUnbondingTime := uint32(2000) currentParams := h.BTCStakingKeeper.GetParams(h.Ctx) currentParams.MinUnbondingTimeBlocks = 2000 + currentParams.BtcActivationHeight = currentParams.BtcActivationHeight + 1 // Update new params err = h.BTCStakingKeeper.SetParams(h.Ctx, currentParams) require.NoError(t, err) diff --git a/x/btcstaking/keeper/params.go b/x/btcstaking/keeper/params.go index 044b8bc9d..699c6b52c 100644 --- a/x/btcstaking/keeper/params.go +++ b/x/btcstaking/keeper/params.go @@ -4,6 +4,7 @@ import ( "context" "encoding/binary" "fmt" + "sort" "cosmossdk.io/math" "cosmossdk.io/store/prefix" @@ -71,7 +72,19 @@ func (k Keeper) SetParams(ctx context.Context, p types.Params) error { return err } + heightToVersionMap := k.GetHeightToVersionMap(ctx) + + if heightToVersionMap == nil { + heightToVersionMap = types.NewHeightToVersionMap() + } + nextVersion := k.nextParamsVersion(ctx) + + err := heightToVersionMap.AddNewPair(uint64(p.BtcActivationHeight), nextVersion) + if err != nil { + return err + } + paramsStore := k.paramsStore(ctx) sp := types.StoredParams{ @@ -80,7 +93,7 @@ func (k Keeper) SetParams(ctx context.Context, p types.Params) error { } paramsStore.Set(uint32ToBytes(nextVersion), k.cdc.MustMarshal(&sp)) - return nil + return k.SetHeightToVersionMap(ctx, heightToVersionMap) } func (k Keeper) OverwriteParamsAtVersion(ctx context.Context, v uint32, p types.Params) error { @@ -89,21 +102,31 @@ func (k Keeper) OverwriteParamsAtVersion(ctx context.Context, v uint32, p types. } paramsStore := k.paramsStore(ctx) - - // check if the params at version v exists - spBytes := paramsStore.Get(uint32ToBytes(v)) - - if len(spBytes) == 0 { - return fmt.Errorf("params at version %d not found", v) - } - sp := types.StoredParams{ Params: p, Version: v, } + heightToVersionMap := k.GetHeightToVersionMap(ctx) + if heightToVersionMap == nil { + heightToVersionMap = types.NewHeightToVersionMap() + } + + // makes sure it is ordered by the version + sort.Slice(heightToVersionMap.Pairs, func(i, j int) bool { + return heightToVersionMap.Pairs[i].Version < heightToVersionMap.Pairs[j].Version + }) + + if v >= uint32(len(heightToVersionMap.Pairs)) { + if err := heightToVersionMap.AddNewPair(uint64(p.BtcActivationHeight), v); err != nil { + return err + } + } else { + heightToVersionMap.Pairs[v] = types.NewHeightVersionPair(uint64(p.BtcActivationHeight), v) + } + paramsStore.Set(uint32ToBytes(v), k.cdc.MustMarshal(&sp)) - return nil + return k.SetHeightToVersionMap(ctx, heightToVersionMap) } func (k Keeper) GetAllParams(ctx context.Context) []*types.Params { @@ -155,3 +178,41 @@ func (k Keeper) GetParamsWithVersion(ctx context.Context) types.StoredParams { func (k Keeper) MinCommissionRate(ctx context.Context) math.LegacyDec { return k.GetParams(ctx).MinCommissionRate } + +func (k Keeper) SetHeightToVersionMap(ctx context.Context, p *types.HeightToVersionMap) error { + if err := p.Validate(); err != nil { + return err + } + store := k.storeService.OpenKVStore(ctx) + bz := k.cdc.MustMarshal(p) + return store.Set(types.HeightToVersionMapKey, bz) +} + +// GetParams returns the current x/btccheckpoint module parameters. +func (k Keeper) GetHeightToVersionMap(ctx context.Context) *types.HeightToVersionMap { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.HeightToVersionMapKey) + if err != nil { + panic(err) + } + if bz == nil { + return nil + } + var p types.HeightToVersionMap + k.cdc.MustUnmarshal(bz, &p) + return &p +} + +func (k Keeper) GetParamsForBtcHeight(ctx context.Context, height uint64) (*types.Params, uint32, error) { + heightToVersionMap := k.GetHeightToVersionMap(ctx) + if heightToVersionMap == nil { + panic("height to version map not found") + } + + version, err := heightToVersionMap.GetVersionForHeight(height) + if err != nil { + return nil, 0, err + } + + return k.GetParamsByVersion(ctx, version), version, nil +} diff --git a/x/btcstaking/keeper/params_test.go b/x/btcstaking/keeper/params_test.go index 81f4d53a6..263008090 100644 --- a/x/btcstaking/keeper/params_test.go +++ b/x/btcstaking/keeper/params_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "fmt" "math" "math/rand" "testing" @@ -16,12 +17,30 @@ func TestGetParams(t *testing.T) { k, ctx := testkeeper.BTCStakingKeeper(t, nil, nil, nil) params := types.DefaultParams() + currParams := k.GetParams(ctx) + params.BtcActivationHeight = currParams.BtcActivationHeight + 1 err := k.SetParams(ctx, params) require.NoError(t, err) require.EqualValues(t, params, k.GetParams(ctx)) } +func TestAddNewPairParams(t *testing.T) { + htvm := types.NewHeightToVersionMap() + // btc start height, version of params + err := htvm.AddNewPair(10, 0) + require.NoError(t, err) + + err = htvm.AddNewPair(11, 1) + require.NoError(t, err) + + err = htvm.AddNewPair(11, 2) + require.EqualError(t, err, fmt.Errorf("pairs must be sorted by start height in ascending order, got %d <= %d", 11, 11).Error()) + + err = htvm.AddNewPair(15, 1) + require.EqualError(t, err, fmt.Errorf("versions must be strictly increasing, got %d != %d + 1", 1, 1).Error()) +} + func TestGetParamsVersions(t *testing.T) { k, ctx := testkeeper.BTCStakingKeeper(t, nil, nil, nil) params := types.DefaultParams() @@ -33,6 +52,7 @@ func TestGetParamsVersions(t *testing.T) { params1 := types.DefaultParams() params1.MinSlashingTxFeeSat = 23400 + params1.BtcActivationHeight = pv.Params.BtcActivationHeight + 1 err := k.SetParams(ctx, params1) require.NoError(t, err) @@ -62,14 +82,17 @@ func FuzzParamsVersioning(f *testing.F) { var generatedParams []*types.Params generatedParams = append(generatedParams, ¶ms0) + var btcActivationHeights []uint32 for i := 0; i < numVersionsToGenerate; i++ { params := types.DefaultParams() // randomize two parameters so each params are slightly different params.MinSlashingTxFeeSat = r.Int63() params.MinUnbondingTimeBlocks = uint32(r.Intn(math.MaxUint16)) + params.BtcActivationHeight = uint32(i) + 1 err := k.SetParams(ctx, params) require.NoError(t, err) generatedParams = append(generatedParams, ¶ms) + btcActivationHeights = append(btcActivationHeights, params.BtcActivationHeight) } allParams := k.GetAllParams(ctx) @@ -90,5 +113,19 @@ func FuzzParamsVersioning(f *testing.F) { lastVer := k.GetParamsByVersion(ctx, uint32(len(generatedParams)-1)) require.EqualValues(t, *generatedParams[len(generatedParams)-1], lastParams) require.EqualValues(t, lastParams, *lastVer) + + heightToVersionMap := k.GetHeightToVersionMap(ctx) + require.NotNil(t, heightToVersionMap) + require.EqualValues(t, len(generatedParams), len(heightToVersionMap.Pairs)) + + for _, btcActivationHeight := range btcActivationHeights { + paramsBTCActivation, version, err := k.GetParamsForBtcHeight(ctx, uint64(btcActivationHeight)) + require.NoError(t, err) + require.NotNil(t, paramsBTCActivation) + + paramsByVersion := k.GetParamsByVersion(ctx, version) + require.NotNil(t, paramsByVersion) + require.EqualValues(t, *paramsBTCActivation, *paramsByVersion) + } }) } diff --git a/x/btcstaking/keeper/query_params.go b/x/btcstaking/keeper/query_params.go index eed444b02..038948969 100644 --- a/x/btcstaking/keeper/query_params.go +++ b/x/btcstaking/keeper/query_params.go @@ -32,3 +32,20 @@ func (k Keeper) ParamsByVersion(goCtx context.Context, req *types.QueryParamsByV return &types.QueryParamsByVersionResponse{Params: *pv}, nil } + +func (k Keeper) ParamsByBTCHeight( + goCtx context.Context, + req *types.QueryParamsByBTCHeightRequest, +) (*types.QueryParamsByBTCHeightResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + p, version, err := k.GetParamsForBtcHeight(ctx, uint64(req.BtcHeight)) + if err != nil { + return nil, types.ErrParamsNotFound.Wrapf("params for btc height %d not found", req.BtcHeight) + } + + return &types.QueryParamsByBTCHeightResponse{Params: *p, Version: version}, nil +} diff --git a/x/btcstaking/keeper/query_params_test.go b/x/btcstaking/keeper/query_params_test.go index 410a856f0..c4157e633 100644 --- a/x/btcstaking/keeper/query_params_test.go +++ b/x/btcstaking/keeper/query_params_test.go @@ -13,6 +13,8 @@ func TestParamsQuery(t *testing.T) { keeper, ctx := testkeeper.BTCStakingKeeper(t, nil, nil, nil) params := types.DefaultParams() + currParams := keeper.GetParams(ctx) + params.BtcActivationHeight = currParams.BtcActivationHeight + 1 err := keeper.SetParams(ctx, params) require.NoError(t, err) @@ -24,14 +26,20 @@ func TestParamsQuery(t *testing.T) { func TestParamsByVersionQuery(t *testing.T) { keeper, ctx := testkeeper.BTCStakingKeeper(t, nil, nil, nil) + currParams := keeper.GetParams(ctx) + // starting with `1` as BTCStakingKeeper creates params with version 0 params1 := types.DefaultParams() params1.MinUnbondingTimeBlocks = 10000 + params1.BtcActivationHeight = currParams.BtcActivationHeight + 1 + params2 := types.DefaultParams() params2.MinUnbondingTimeBlocks = 20000 + params2.BtcActivationHeight = currParams.BtcActivationHeight + 2 + params3 := types.DefaultParams() params3.MinUnbondingTimeBlocks = 30000 - + params3.BtcActivationHeight = currParams.BtcActivationHeight + 3 // Check that after update we always return the latest version of params through Params query err := keeper.SetParams(ctx, params1) require.NoError(t, err) @@ -64,3 +72,38 @@ func TestParamsByVersionQuery(t *testing.T) { require.NoError(t, err) require.Equal(t, &types.QueryParamsByVersionResponse{Params: params3}, resp2) } + +func TestParamsByBTCHeightQuery(t *testing.T) { + keeper, ctx := testkeeper.BTCStakingKeeper(t, nil, nil, nil) + currParams := keeper.GetParams(ctx) + + // starting with `1` as BTCStakingKeeper creates params with version 0 + params1 := types.DefaultParams() + params1.MinUnbondingTimeBlocks = 10000 + params1.BtcActivationHeight = currParams.BtcActivationHeight + 1 + + params2 := types.DefaultParams() + params2.MinUnbondingTimeBlocks = 20000 + params2.BtcActivationHeight = currParams.BtcActivationHeight + 2 + + // Check that after update we always return the latest version of params through Params query + err := keeper.SetParams(ctx, params1) + require.NoError(t, err) + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params1}, response) + + err = keeper.SetParams(ctx, params2) + require.NoError(t, err) + response, err = keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params2}, response) + + resp0, err := keeper.ParamsByBTCHeight(ctx, &types.QueryParamsByBTCHeightRequest{BtcHeight: params1.BtcActivationHeight}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsByBTCHeightResponse{Params: params1, Version: 1}, resp0) + + resp1, err := keeper.ParamsByBTCHeight(ctx, &types.QueryParamsByBTCHeightRequest{BtcHeight: params2.BtcActivationHeight}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsByBTCHeightResponse{Params: params2, Version: 2}, resp1) +} diff --git a/x/btcstaking/types/genesis.go b/x/btcstaking/types/genesis.go index 73ad67db2..9746fb6b6 100644 --- a/x/btcstaking/types/genesis.go +++ b/x/btcstaking/types/genesis.go @@ -22,11 +22,19 @@ func (gs GenesisState) Validate() error { return fmt.Errorf("params cannot be empty") } + heightToVersionMap := NewHeightToVersionMap() // TODO: add validation to other properties of genstate. - for _, params := range gs.Params { + for i, params := range gs.Params { if err := params.Validate(); err != nil { return err } + + err := heightToVersionMap.AddNewPair(uint64(i), params.BtcActivationHeight) + + if err != nil { + return err + } + } return nil } diff --git a/x/btcstaking/types/keys.go b/x/btcstaking/types/keys.go index a3313b97b..f9a3e61b3 100644 --- a/x/btcstaking/types/keys.go +++ b/x/btcstaking/types/keys.go @@ -26,4 +26,5 @@ var ( // 0x07 was used for something else in the past PowerDistUpdateKey = []byte{0x08} // key prefix for power distribution update events AllowedStakingTxHashesKey = collections.NewPrefix(9) // key prefix for allowed staking tx hashes + HeightToVersionMapKey = []byte{0x10} // key prefix for height to version map ) diff --git a/x/btcstaking/types/params.go b/x/btcstaking/types/params.go index fa982524e..8f9030c7b 100644 --- a/x/btcstaking/types/params.go +++ b/x/btcstaking/types/params.go @@ -3,6 +3,7 @@ package types import ( "fmt" "math" + "sort" sdkmath "cosmossdk.io/math" "github.com/btcsuite/btcd/btcec/v2" @@ -79,6 +80,7 @@ func DefaultParams() Params { // The default allow list expiration height is 0, which effectively disables the allow list. // Allow list can only be enabled by upgrade AllowListExpirationHeight: 0, + BtcActivationHeight: 0, } } @@ -236,3 +238,136 @@ func (p Params) MustGetCovenantPks() []*btcec.PublicKey { return covenantKeys } + +func NewHeightVersionPair( + startHeight uint64, + version uint32, +) *HeightVersionPair { + return &HeightVersionPair{ + StartHeight: startHeight, + Version: version, + } +} + +func NewHeightToVersionMap() *HeightToVersionMap { + return &HeightToVersionMap{ + Pairs: []*HeightVersionPair{}, + } +} + +func (m *HeightToVersionMap) GetLastPair() *HeightVersionPair { + if m.IsEmpty() { + return nil + } + return m.Pairs[len(m.Pairs)-1] +} + +// AddNewPair adds a new pair to the map it preserves the following invariants: +// 1. pairs are sorted by start height in ascending order +// 2. versions are strictly increasing by increments of 1 +// If newPair breaks any of the invariants, it returns an error +func (m *HeightToVersionMap) AddNewPair(startHeight uint64, version uint32) error { + return m.AddPair(&HeightVersionPair{ + StartHeight: startHeight, + Version: version, + }) +} + +// AddPair adds a new pair to the map it preserves the following invariants: +// 1. pairs are sorted by start height in ascending order +// 2. versions are strictly increasing by increments of 1 +// If newPair breaks any of the invariants, it returns an error +func (m *HeightToVersionMap) AddPair(newPair *HeightVersionPair) error { + if len(m.Pairs) == 0 && newPair.Version != 0 { + return fmt.Errorf("version must be 0 for the first pair") + } + + if len(m.Pairs) == 0 && newPair.Version == 0 { + m.Pairs = append(m.Pairs, newPair) + return nil + } + + // we already checked `m.Pairs` is not empty, so this won't be nil + lastPair := m.GetLastPair() + + if newPair.StartHeight <= lastPair.StartHeight { + return fmt.Errorf("pairs must be sorted by start height in ascending order, got %d <= %d", + newPair.StartHeight, lastPair.StartHeight) + } + + if newPair.Version != lastPair.Version+1 { + return fmt.Errorf("versions must be strictly increasing, got %d != %d + 1", + newPair.Version, lastPair.Version) + } + + m.Pairs = append(m.Pairs, newPair) + return nil +} + +func NewHeightToVersionMapFromPairs(pairs []*HeightVersionPair) (*HeightToVersionMap, error) { + if len(pairs) == 0 { + return nil, fmt.Errorf("can't construct HeightToVersionMap from empty list of HeightVersionPair") + } + + heightToVersionMap := NewHeightToVersionMap() + + for _, pair := range pairs { + if err := heightToVersionMap.AddPair(pair); err != nil { + return nil, err + } + } + + return heightToVersionMap, nil +} + +func (m *HeightToVersionMap) IsEmpty() bool { + return len(m.Pairs) == 0 +} + +func (m *HeightToVersionMap) GetVersionForHeight(height uint64) (uint32, error) { + if m.IsEmpty() { + return 0, fmt.Errorf("height to version map is empty") + } + + // Binary search to find the applicable version of the parameters + idx := sort.Search(len(m.Pairs), func(i int) bool { + return m.Pairs[i].StartHeight > height + }) - 1 + + if idx < 0 { + return 0, fmt.Errorf("no parameters found for block height %d", height) + } + + return m.Pairs[idx].Version, nil +} + +func (m *HeightToVersionMap) Validate() error { + if len(m.Pairs) == 0 { + return fmt.Errorf("height to version map is empty") + } + + if len(m.Pairs) == 1 { + if m.Pairs[0].Version != 0 { + return fmt.Errorf("version must be 0 for the first pair") + } + return nil + } + + for i, pair := range m.Pairs { + if i == 0 { + continue + } + + if pair.StartHeight <= m.Pairs[i-1].StartHeight { + return fmt.Errorf("pairs must be sorted by start height in ascending order, got %d <= %d", + pair.StartHeight, m.Pairs[i-1].StartHeight) + } + + if pair.Version != m.Pairs[i-1].Version+1 { + return fmt.Errorf("versions must be strictly increasing, got %d != %d + 1", + pair.Version, m.Pairs[i-1].Version) + } + } + + return nil +} diff --git a/x/btcstaking/types/params.pb.go b/x/btcstaking/types/params.pb.go index 1d96cd61b..724b2b7e0 100644 --- a/x/btcstaking/types/params.pb.go +++ b/x/btcstaking/types/params.pb.go @@ -71,6 +71,8 @@ type Params struct { // i.e all staking transactions are allowed to enter Babylon chain afterwards // setting it to 0 means allow list is disabled AllowListExpirationHeight uint64 `protobuf:"varint,14,opt,name=allow_list_expiration_height,json=allowListExpirationHeight,proto3" json:"allow_list_expiration_height,omitempty"` + // btc_activation_height is the btc height from which parameters are activated (inclusive) + BtcActivationHeight uint32 `protobuf:"varint,15,opt,name=btc_activation_height,json=btcActivationHeight,proto3" json:"btc_activation_height,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -182,6 +184,114 @@ func (m *Params) GetAllowListExpirationHeight() uint64 { return 0 } +func (m *Params) GetBtcActivationHeight() uint32 { + if m != nil { + return m.BtcActivationHeight + } + return 0 +} + +// HeightVersionPair pairs a btc height with a version of the parameters +type HeightVersionPair struct { + // start_height is the height from which the parameters are activated (inclusive) + StartHeight uint64 `protobuf:"varint,1,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + // version is the version of the parameters + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *HeightVersionPair) Reset() { *m = HeightVersionPair{} } +func (m *HeightVersionPair) String() string { return proto.CompactTextString(m) } +func (*HeightVersionPair) ProtoMessage() {} +func (*HeightVersionPair) Descriptor() ([]byte, []int) { + return fileDescriptor_8d1392776a3e15b9, []int{1} +} +func (m *HeightVersionPair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeightVersionPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeightVersionPair.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 *HeightVersionPair) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeightVersionPair.Merge(m, src) +} +func (m *HeightVersionPair) XXX_Size() int { + return m.Size() +} +func (m *HeightVersionPair) XXX_DiscardUnknown() { + xxx_messageInfo_HeightVersionPair.DiscardUnknown(m) +} + +var xxx_messageInfo_HeightVersionPair proto.InternalMessageInfo + +func (m *HeightVersionPair) GetStartHeight() uint64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *HeightVersionPair) GetVersion() uint32 { + if m != nil { + return m.Version + } + return 0 +} + +// HeightToVersionMap maps a btc height to a version of the parameters +type HeightToVersionMap struct { + // Pairs must be sorted by `start_height` in ascending order, without duplicates + Pairs []*HeightVersionPair `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs,omitempty"` +} + +func (m *HeightToVersionMap) Reset() { *m = HeightToVersionMap{} } +func (m *HeightToVersionMap) String() string { return proto.CompactTextString(m) } +func (*HeightToVersionMap) ProtoMessage() {} +func (*HeightToVersionMap) Descriptor() ([]byte, []int) { + return fileDescriptor_8d1392776a3e15b9, []int{2} +} +func (m *HeightToVersionMap) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeightToVersionMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeightToVersionMap.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 *HeightToVersionMap) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeightToVersionMap.Merge(m, src) +} +func (m *HeightToVersionMap) XXX_Size() int { + return m.Size() +} +func (m *HeightToVersionMap) XXX_DiscardUnknown() { + xxx_messageInfo_HeightToVersionMap.DiscardUnknown(m) +} + +var xxx_messageInfo_HeightToVersionMap proto.InternalMessageInfo + +func (m *HeightToVersionMap) GetPairs() []*HeightVersionPair { + if m != nil { + return m.Pairs + } + return nil +} + // StoredParams attach information about the version of stored parameters type StoredParams struct { // version of the stored parameters. Each parameters update @@ -195,7 +305,7 @@ func (m *StoredParams) Reset() { *m = StoredParams{} } func (m *StoredParams) String() string { return proto.CompactTextString(m) } func (*StoredParams) ProtoMessage() {} func (*StoredParams) Descriptor() ([]byte, []int) { - return fileDescriptor_8d1392776a3e15b9, []int{1} + return fileDescriptor_8d1392776a3e15b9, []int{3} } func (m *StoredParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -240,6 +350,8 @@ func (m *StoredParams) GetParams() Params { func init() { proto.RegisterType((*Params)(nil), "babylon.btcstaking.v1.Params") + proto.RegisterType((*HeightVersionPair)(nil), "babylon.btcstaking.v1.HeightVersionPair") + proto.RegisterType((*HeightToVersionMap)(nil), "babylon.btcstaking.v1.HeightToVersionMap") proto.RegisterType((*StoredParams)(nil), "babylon.btcstaking.v1.StoredParams") } @@ -248,49 +360,54 @@ func init() { } var fileDescriptor_8d1392776a3e15b9 = []byte{ - // 658 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0x8d, 0xbf, 0xe6, 0x4b, 0xe9, 0x34, 0x6d, 0xa9, 0x69, 0xc1, 0x2d, 0x25, 0xb1, 0xca, 0x82, - 0x08, 0x51, 0x9b, 0xd0, 0x22, 0xf1, 0xb3, 0x40, 0x72, 0x4b, 0x01, 0x51, 0xa1, 0xe0, 0x94, 0x2e, - 0x60, 0x61, 0x8d, 0x9d, 0x8b, 0x33, 0xb2, 0xc7, 0x63, 0x3c, 0x93, 0x90, 0xbc, 0x05, 0x4b, 0x96, - 0x3c, 0x04, 0x0f, 0xd1, 0x65, 0xc5, 0x0a, 0x75, 0x51, 0xa1, 0x66, 0xc5, 0x5b, 0x20, 0x8f, 0xed, - 0x24, 0xaa, 0xba, 0xe8, 0xce, 0x33, 0xe7, 0xe7, 0x9e, 0xe3, 0xe4, 0x1a, 0x6d, 0xba, 0xd8, 0x1d, - 0x86, 0x2c, 0x32, 0x5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x00, 0xff, 0xff, 0xdc, 0xd0, 0x43, 0xb7, 0x97, 0x04, - 0x00, 0x00, + // 737 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x4e, 0x13, 0x41, + 0x1c, 0xef, 0x4a, 0x29, 0x32, 0x2d, 0x20, 0x0b, 0xe8, 0x82, 0xd8, 0xd6, 0x7a, 0xb0, 0x31, 0xb2, + 0xb5, 0x80, 0x89, 0x1f, 0x89, 0xc6, 0x82, 0xa8, 0x11, 0x4d, 0xdd, 0x56, 0x0e, 0x7a, 0xd8, 0xcc, + 0x4e, 0xc7, 0xed, 0xa4, 0xbb, 0x3b, 0xeb, 0xce, 0xb4, 0xb6, 0x6f, 0xe1, 0xd1, 0x8b, 0x89, 0x0f, + 0xe1, 0x43, 0x70, 0x24, 0x9e, 0x0c, 0x07, 0x62, 0xe0, 0x45, 0xcc, 0xce, 0xcc, 0xb6, 0x05, 0x31, + 0xe1, 0xb6, 0x33, 0xbf, 0xaf, 0xff, 0xaf, 0xdb, 0xfd, 0x83, 0x92, 0x03, 0x9d, 0x81, 0x47, 0x83, + 0x8a, 0xc3, 0x11, 0xe3, 0xb0, 0x43, 0x02, 0xb7, 0xd2, 0xab, 0x56, 0x42, 0x18, 0x41, 0x9f, 0x99, + 0x61, 0x44, 0x39, 0xd5, 0x97, 0x14, 0xc7, 0x1c, 0x71, 0xcc, 0x5e, 0x75, 0x65, 0xd1, 0xa5, 0x2e, + 0x15, 0x8c, 0x4a, 0xfc, 0x24, 0xc9, 0x2b, 0xcb, 0x88, 0x32, 0x9f, 0x32, 0x5b, 0x02, 0xf2, 0x20, + 0xa1, 0xd2, 0xf7, 0x29, 0x90, 0xa9, 0x0b, 0x63, 0xfd, 0x23, 0xc8, 0x21, 0xda, 0xc3, 0x01, 0x0c, + 0xb8, 0x1d, 0x76, 0x98, 0xa1, 0x15, 0x27, 0xca, 0xb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f8, 0x42, 0x15, 0x0b, 0xcb, 0xc9, + 0x88, 0x2d, 0xb8, 0xf1, 0x37, 0x00, 0x00, 0xff, 0xff, 0x02, 0xe4, 0x5b, 0xfa, 0x73, 0x05, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -313,6 +430,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.BtcActivationHeight != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.BtcActivationHeight)) + i-- + dAtA[i] = 0x78 + } if m.AllowListExpirationHeight != 0 { i = encodeVarintParams(dAtA, i, uint64(m.AllowListExpirationHeight)) i-- @@ -407,6 +529,76 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *HeightVersionPair) 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 *HeightVersionPair) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeightVersionPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Version != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x10 + } + if m.StartHeight != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *HeightToVersionMap) 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 *HeightToVersionMap) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeightToVersionMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Pairs) > 0 { + for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Pairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *StoredParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -506,6 +698,39 @@ func (m *Params) Size() (n int) { if m.AllowListExpirationHeight != 0 { n += 1 + sovParams(uint64(m.AllowListExpirationHeight)) } + if m.BtcActivationHeight != 0 { + n += 1 + sovParams(uint64(m.BtcActivationHeight)) + } + return n +} + +func (m *HeightVersionPair) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StartHeight != 0 { + n += 1 + sovParams(uint64(m.StartHeight)) + } + if m.Version != 0 { + n += 1 + sovParams(uint64(m.Version)) + } + return n +} + +func (m *HeightToVersionMap) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Pairs) > 0 { + for _, e := range m.Pairs { + l = e.Size() + n += 1 + l + sovParams(uint64(l)) + } + } return n } @@ -885,6 +1110,197 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcActivationHeight", wireType) + } + m.BtcActivationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BtcActivationHeight |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeightVersionPair) 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 ErrIntOverflowParams + } + 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: HeightVersionPair: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeightVersionPair: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeightToVersionMap) 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 ErrIntOverflowParams + } + 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: HeightToVersionMap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeightToVersionMap: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pairs", 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 + } + m.Pairs = append(m.Pairs, &HeightVersionPair{}) + if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/btcstaking/types/params_test.go b/x/btcstaking/types/params_test.go new file mode 100644 index 000000000..7917adfd5 --- /dev/null +++ b/x/btcstaking/types/params_test.go @@ -0,0 +1,126 @@ +package types_test + +import ( + "testing" + + "github.com/babylonlabs-io/babylon/x/btcstaking/types" + "github.com/stretchr/testify/require" +) + +func TestHeightToVersionMap(t *testing.T) { + testCases := []struct { + name string + heightToVer types.HeightToVersionMap + height uint64 + expectedVer uint32 + expectedError bool + }{ + { + name: "empty map returns error", + heightToVer: types.HeightToVersionMap{}, + height: 100, + expectedError: true, + }, + { + name: "exact height match for first pair", + heightToVer: types.HeightToVersionMap{ + Pairs: []*types.HeightVersionPair{ + { + StartHeight: 100, + Version: 1, + }, + { + StartHeight: 200, + Version: 2, + }, + }, + }, + + height: 100, + expectedVer: 1, + }, + { + name: "exact height match for second pair", + heightToVer: types.HeightToVersionMap{ + Pairs: []*types.HeightVersionPair{ + { + StartHeight: 100, + Version: 1, + }, + { + StartHeight: 200, + Version: 2, + }, + }, + }, + + height: 200, + expectedVer: 2, + }, + { + name: "height between versions", + heightToVer: types.HeightToVersionMap{ + Pairs: []*types.HeightVersionPair{ + { + StartHeight: 100, + Version: 1, + }, + { + StartHeight: 200, + Version: 2, + }, + }, + }, + height: 150, + expectedVer: 1, + }, + { + name: "height after last version", + heightToVer: types.HeightToVersionMap{ + Pairs: []*types.HeightVersionPair{ + { + StartHeight: 100, + Version: 1, + }, + { + StartHeight: 200, + Version: 2, + }, + }, + }, + height: 300, + expectedVer: 2, + }, + { + name: "height before first version", + heightToVer: types.HeightToVersionMap{ + Pairs: []*types.HeightVersionPair{ + { + StartHeight: 100, + Version: 1, + }, + { + StartHeight: 200, + Version: 2, + }, + }, + }, + height: 99, + expectedError: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + version, err := tc.heightToVer.GetVersionForHeight(tc.height) + + if tc.expectedError { + require.Error(t, err) + return + } + + require.NoError(t, err) + require.Equal(t, tc.expectedVer, version) + }) + } +} diff --git a/x/btcstaking/types/query.pb.go b/x/btcstaking/types/query.pb.go index 5d8e91fd8..32304b232 100644 --- a/x/btcstaking/types/query.pb.go +++ b/x/btcstaking/types/query.pb.go @@ -208,6 +208,106 @@ func (m *QueryParamsByVersionResponse) GetParams() Params { return Params{} } +// QueryParamsByBTCHeightRequest is request type for the Query/ParamsByBTCHeight RPC method. +type QueryParamsByBTCHeightRequest struct { + BtcHeight uint32 `protobuf:"varint,1,opt,name=btc_height,json=btcHeight,proto3" json:"btc_height,omitempty"` +} + +func (m *QueryParamsByBTCHeightRequest) Reset() { *m = QueryParamsByBTCHeightRequest{} } +func (m *QueryParamsByBTCHeightRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsByBTCHeightRequest) ProtoMessage() {} +func (*QueryParamsByBTCHeightRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_74d49d26f7429697, []int{4} +} +func (m *QueryParamsByBTCHeightRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsByBTCHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsByBTCHeightRequest.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 *QueryParamsByBTCHeightRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsByBTCHeightRequest.Merge(m, src) +} +func (m *QueryParamsByBTCHeightRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsByBTCHeightRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsByBTCHeightRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsByBTCHeightRequest proto.InternalMessageInfo + +func (m *QueryParamsByBTCHeightRequest) GetBtcHeight() uint32 { + if m != nil { + return m.BtcHeight + } + return 0 +} + +// QueryParamsByBTCHeightResponse is response type for the Query/QueryParamsByBTCHeightResponse RPC method. +type QueryParamsByBTCHeightResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // version is the version of the params for the given BTC height + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *QueryParamsByBTCHeightResponse) Reset() { *m = QueryParamsByBTCHeightResponse{} } +func (m *QueryParamsByBTCHeightResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsByBTCHeightResponse) ProtoMessage() {} +func (*QueryParamsByBTCHeightResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_74d49d26f7429697, []int{5} +} +func (m *QueryParamsByBTCHeightResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsByBTCHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsByBTCHeightResponse.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 *QueryParamsByBTCHeightResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsByBTCHeightResponse.Merge(m, src) +} +func (m *QueryParamsByBTCHeightResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsByBTCHeightResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsByBTCHeightResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsByBTCHeightResponse proto.InternalMessageInfo + +func (m *QueryParamsByBTCHeightResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *QueryParamsByBTCHeightResponse) GetVersion() uint32 { + if m != nil { + return m.Version + } + return 0 +} + // QueryFinalityProvidersRequest is the request type for the // Query/FinalityProviders RPC method. type QueryFinalityProvidersRequest struct { @@ -219,7 +319,7 @@ func (m *QueryFinalityProvidersRequest) Reset() { *m = QueryFinalityProv func (m *QueryFinalityProvidersRequest) String() string { return proto.CompactTextString(m) } func (*QueryFinalityProvidersRequest) ProtoMessage() {} func (*QueryFinalityProvidersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{4} + return fileDescriptor_74d49d26f7429697, []int{6} } func (m *QueryFinalityProvidersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -268,7 +368,7 @@ func (m *QueryFinalityProvidersResponse) Reset() { *m = QueryFinalityPro func (m *QueryFinalityProvidersResponse) String() string { return proto.CompactTextString(m) } func (*QueryFinalityProvidersResponse) ProtoMessage() {} func (*QueryFinalityProvidersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{5} + return fileDescriptor_74d49d26f7429697, []int{7} } func (m *QueryFinalityProvidersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -321,7 +421,7 @@ func (m *QueryFinalityProviderRequest) Reset() { *m = QueryFinalityProvi func (m *QueryFinalityProviderRequest) String() string { return proto.CompactTextString(m) } func (*QueryFinalityProviderRequest) ProtoMessage() {} func (*QueryFinalityProviderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{6} + return fileDescriptor_74d49d26f7429697, []int{8} } func (m *QueryFinalityProviderRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -367,7 +467,7 @@ func (m *QueryFinalityProviderResponse) Reset() { *m = QueryFinalityProv func (m *QueryFinalityProviderResponse) String() string { return proto.CompactTextString(m) } func (*QueryFinalityProviderResponse) ProtoMessage() {} func (*QueryFinalityProviderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{7} + return fileDescriptor_74d49d26f7429697, []int{9} } func (m *QueryFinalityProviderResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -416,7 +516,7 @@ func (m *QueryBTCDelegationsRequest) Reset() { *m = QueryBTCDelegationsR func (m *QueryBTCDelegationsRequest) String() string { return proto.CompactTextString(m) } func (*QueryBTCDelegationsRequest) ProtoMessage() {} func (*QueryBTCDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{8} + return fileDescriptor_74d49d26f7429697, []int{10} } func (m *QueryBTCDelegationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -472,7 +572,7 @@ func (m *QueryBTCDelegationsResponse) Reset() { *m = QueryBTCDelegations func (m *QueryBTCDelegationsResponse) String() string { return proto.CompactTextString(m) } func (*QueryBTCDelegationsResponse) ProtoMessage() {} func (*QueryBTCDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{9} + return fileDescriptor_74d49d26f7429697, []int{11} } func (m *QueryBTCDelegationsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -532,7 +632,7 @@ func (m *QueryFinalityProviderDelegationsRequest) Reset() { func (m *QueryFinalityProviderDelegationsRequest) String() string { return proto.CompactTextString(m) } func (*QueryFinalityProviderDelegationsRequest) ProtoMessage() {} func (*QueryFinalityProviderDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{10} + return fileDescriptor_74d49d26f7429697, []int{12} } func (m *QueryFinalityProviderDelegationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -590,7 +690,7 @@ func (m *QueryFinalityProviderDelegationsResponse) Reset() { func (m *QueryFinalityProviderDelegationsResponse) String() string { return proto.CompactTextString(m) } func (*QueryFinalityProviderDelegationsResponse) ProtoMessage() {} func (*QueryFinalityProviderDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{11} + return fileDescriptor_74d49d26f7429697, []int{13} } func (m *QueryFinalityProviderDelegationsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -644,7 +744,7 @@ func (m *QueryBTCDelegationRequest) Reset() { *m = QueryBTCDelegationReq func (m *QueryBTCDelegationRequest) String() string { return proto.CompactTextString(m) } func (*QueryBTCDelegationRequest) ProtoMessage() {} func (*QueryBTCDelegationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{12} + return fileDescriptor_74d49d26f7429697, []int{14} } func (m *QueryBTCDelegationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -691,7 +791,7 @@ func (m *QueryBTCDelegationResponse) Reset() { *m = QueryBTCDelegationRe func (m *QueryBTCDelegationResponse) String() string { return proto.CompactTextString(m) } func (*QueryBTCDelegationResponse) ProtoMessage() {} func (*QueryBTCDelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{13} + return fileDescriptor_74d49d26f7429697, []int{15} } func (m *QueryBTCDelegationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -779,7 +879,7 @@ func (m *BTCDelegationResponse) Reset() { *m = BTCDelegationResponse{} } func (m *BTCDelegationResponse) String() string { return proto.CompactTextString(m) } func (*BTCDelegationResponse) ProtoMessage() {} func (*BTCDelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{14} + return fileDescriptor_74d49d26f7429697, []int{16} } func (m *BTCDelegationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -925,7 +1025,7 @@ func (m *DelegatorUnbondingInfoResponse) Reset() { *m = DelegatorUnbondi func (m *DelegatorUnbondingInfoResponse) String() string { return proto.CompactTextString(m) } func (*DelegatorUnbondingInfoResponse) ProtoMessage() {} func (*DelegatorUnbondingInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{15} + return fileDescriptor_74d49d26f7429697, []int{17} } func (m *DelegatorUnbondingInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -990,7 +1090,7 @@ func (m *BTCUndelegationResponse) Reset() { *m = BTCUndelegationResponse func (m *BTCUndelegationResponse) String() string { return proto.CompactTextString(m) } func (*BTCUndelegationResponse) ProtoMessage() {} func (*BTCUndelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{16} + return fileDescriptor_74d49d26f7429697, []int{18} } func (m *BTCUndelegationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1070,7 +1170,7 @@ func (m *BTCDelegatorDelegationsResponse) Reset() { *m = BTCDelegatorDel func (m *BTCDelegatorDelegationsResponse) String() string { return proto.CompactTextString(m) } func (*BTCDelegatorDelegationsResponse) ProtoMessage() {} func (*BTCDelegatorDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{17} + return fileDescriptor_74d49d26f7429697, []int{19} } func (m *BTCDelegatorDelegationsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1141,7 +1241,7 @@ func (m *FinalityProviderResponse) Reset() { *m = FinalityProviderRespon func (m *FinalityProviderResponse) String() string { return proto.CompactTextString(m) } func (*FinalityProviderResponse) ProtoMessage() {} func (*FinalityProviderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_74d49d26f7429697, []int{18} + return fileDescriptor_74d49d26f7429697, []int{20} } func (m *FinalityProviderResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1231,6 +1331,8 @@ func init() { proto.RegisterType((*QueryParamsResponse)(nil), "babylon.btcstaking.v1.QueryParamsResponse") proto.RegisterType((*QueryParamsByVersionRequest)(nil), "babylon.btcstaking.v1.QueryParamsByVersionRequest") proto.RegisterType((*QueryParamsByVersionResponse)(nil), "babylon.btcstaking.v1.QueryParamsByVersionResponse") + proto.RegisterType((*QueryParamsByBTCHeightRequest)(nil), "babylon.btcstaking.v1.QueryParamsByBTCHeightRequest") + proto.RegisterType((*QueryParamsByBTCHeightResponse)(nil), "babylon.btcstaking.v1.QueryParamsByBTCHeightResponse") proto.RegisterType((*QueryFinalityProvidersRequest)(nil), "babylon.btcstaking.v1.QueryFinalityProvidersRequest") proto.RegisterType((*QueryFinalityProvidersResponse)(nil), "babylon.btcstaking.v1.QueryFinalityProvidersResponse") proto.RegisterType((*QueryFinalityProviderRequest)(nil), "babylon.btcstaking.v1.QueryFinalityProviderRequest") @@ -1251,114 +1353,118 @@ func init() { func init() { proto.RegisterFile("babylon/btcstaking/v1/query.proto", fileDescriptor_74d49d26f7429697) } var fileDescriptor_74d49d26f7429697 = []byte{ - // 1699 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x6f, 0xdb, 0xc8, - 0x15, 0x0f, 0x63, 0x45, 0xb1, 0x9f, 0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d, 0xf5, 0xcc, 0xd7, 0xef, 0xaa, - 0x67, 0xfe, 0xfe, 0xae, 0x7a, 0xe6, 0x27, 0xc7, 0x18, 0x43, 0x83, 0x74, 0x44, 0x3e, 0x93, 0x5a, - 0x79, 0xfe, 0x37, 0xe4, 0xfd, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xdb, 0x0e, 0x28, 0xd0, - 0x15, 0x00, 0x00, + // 1772 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcb, 0x6f, 0xdb, 0xc8, + 0x19, 0x0f, 0x6d, 0x45, 0xb1, 0x3f, 0xf9, 0x39, 0xeb, 0x24, 0x8c, 0xbc, 0x91, 0x1d, 0x35, 0x9b, + 0x38, 0x0f, 0x8b, 0xb1, 0xe3, 0x34, 0x2d, 0x82, 0x6c, 0x1b, 0xd9, 0xbb, 0x9b, 0x74, 0x37, 0x8d, + 0x4b, 0x25, 0x7b, 0xe8, 0x4b, 0xa0, 0xc8, 0x11, 0xc5, 0x46, 0xe2, 0x30, 0x9c, 0x91, 0x2b, 0x23, + 0x30, 0x50, 0xf4, 0xd0, 0x73, 0x81, 0xf6, 0x8f, 0x28, 0xd0, 0x4b, 0x81, 0xe6, 0xd2, 0x43, 0xd1, + 0xeb, 0xf6, 0xb6, 0x48, 0x2f, 0xc5, 0x1e, 0x82, 0x22, 0x29, 0x50, 0xa0, 0x40, 0xef, 0x45, 0x4f, + 0x05, 0x67, 0x86, 0x0f, 0x49, 0xa4, 0x6c, 0x79, 0x7d, 0x23, 0xe7, 0x7b, 0xff, 0xe6, 0xf7, 0xcd, + 0xc7, 0x21, 0x5c, 0x6a, 0x18, 0x8d, 0xfd, 0x36, 0x71, 0xb5, 0x06, 0x33, 0x29, 0x33, 0x9e, 0x3b, + 0xae, 0xad, 0xed, 0x6d, 0x68, 0x2f, 0xba, 0xd8, 0xdf, 0xaf, 0x78, 0x3e, 0x61, 0x04, 0x9d, 0x95, + 0x2a, 0x95, 0x58, 0xa5, 0xb2, 0xb7, 0x51, 0x5c, 0xb2, 0x89, 0x4d, 0xb8, 0x86, 0x16, 0x3c, 0x09, + 0xe5, 0xe2, 0xfb, 0x36, 0x21, 0x76, 0x1b, 0x6b, 0x86, 0xe7, 0x68, 0x86, 0xeb, 0x12, 0x66, 0x30, + 0x87, 0xb8, 0x54, 0x4a, 0x2f, 0x98, 0x84, 0x76, 0x08, 0xad, 0x0b, 0x33, 0xf1, 0x22, 0x45, 0x97, + 0xc5, 0x9b, 0x16, 0x27, 0xd1, 0xc0, 0xcc, 0xd8, 0x08, 0xdf, 0xa5, 0xd6, 0x75, 0xa9, 0xd5, 0x30, + 0x28, 0x16, 0x49, 0x46, 0x8a, 0x9e, 0x61, 0x3b, 0x2e, 0x8f, 0x26, 0x75, 0xcb, 0xe9, 0xa5, 0x79, + 0x86, 0x6f, 0x74, 0xc2, 0xa8, 0x57, 0xd2, 0x75, 0x12, 0x95, 0x0a, 0xbd, 0x95, 0x0c, 0x5f, 0xc4, + 0x13, 0x0a, 0xe5, 0x25, 0x40, 0x3f, 0x08, 0xd2, 0xd9, 0xe5, 0xde, 0x75, 0xfc, 0xa2, 0x8b, 0x29, + 0x2b, 0xeb, 0xf0, 0x5e, 0xdf, 0x2a, 0xf5, 0x88, 0x4b, 0x31, 0xba, 0x07, 0x79, 0x91, 0x85, 0xaa, + 0xac, 0x2a, 0x6b, 0x85, 0xcd, 0x8b, 0x95, 0x54, 0x88, 0x2b, 0xc2, 0xac, 0x9a, 0xfb, 0xe2, 0xcd, + 0xca, 0x29, 0x5d, 0x9a, 0x94, 0xef, 0xc2, 0x72, 0xc2, 0x67, 0x75, 0xff, 0x73, 0xec, 0x53, 0x87, + 0xb8, 0x32, 0x24, 0x52, 0xe1, 0xcc, 0x9e, 0x58, 0xe1, 0xce, 0x67, 0xf5, 0xf0, 0xb5, 0xfc, 0x23, + 0x78, 0x3f, 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xc5, 0x21, 0x30, 0x24, 0xfc, 0x63, 0x63, 0xb1, + 0x30, 0x88, 0x45, 0xf9, 0x77, 0x0a, 0x14, 0x79, 0xfc, 0xea, 0xd3, 0xed, 0x1d, 0xdc, 0xc6, 0xb6, + 0x38, 0xa7, 0xc2, 0x02, 0xaa, 0x90, 0xa7, 0xcc, 0x60, 0x5d, 0x41, 0xb6, 0xb9, 0xcd, 0xeb, 0x19, + 0x11, 0xfb, 0xac, 0x6b, 0xdc, 0x42, 0x97, 0x96, 0x03, 0xc4, 0x99, 0x38, 0x36, 0x71, 0xfe, 0xac, + 0xc8, 0x8e, 0x1f, 0x4c, 0x55, 0x02, 0xf5, 0x0c, 0xe6, 0x03, 0xa4, 0xad, 0x58, 0x24, 0x29, 0x73, + 0xf3, 0x28, 0x49, 0x47, 0x18, 0xcd, 0x35, 0x98, 0x99, 0x70, 0x7f, 0x72, 0x64, 0xf9, 0xad, 0x02, + 0x57, 0x53, 0xb7, 0x3a, 0x05, 0xf7, 0xc3, 0x89, 0x73, 0x62, 0xb0, 0xfe, 0x4b, 0x81, 0xb5, 0xc3, + 0xd3, 0x92, 0x18, 0xfb, 0x70, 0x21, 0x81, 0x31, 0xf1, 0x53, 0xd0, 0xfe, 0xe6, 0xa1, 0x68, 0x93, + 0x34, 0xd7, 0xfa, 0xf9, 0x18, 0xf7, 0x3e, 0x85, 0x93, 0xdb, 0x80, 0xef, 0xc1, 0x85, 0x61, 0xfe, + 0x84, 0x88, 0xaf, 0xc3, 0x7b, 0x32, 0xd9, 0x3a, 0xeb, 0xd5, 0x5b, 0x06, 0x6d, 0x25, 0x70, 0x5f, + 0x90, 0xa2, 0xa7, 0xbd, 0x87, 0x06, 0x6d, 0x05, 0x6d, 0xfb, 0x22, 0xad, 0x6d, 0x22, 0x98, 0x6a, + 0x30, 0xd7, 0x4f, 0x45, 0xd9, 0xb0, 0xe3, 0x31, 0x71, 0xb6, 0x8f, 0x89, 0xe5, 0xff, 0xe5, 0xe1, + 0x6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d, 0x94, 0xd5, + 0x20, 0x17, 0xf1, 0x6d, 0x54, 0x0f, 0x3f, 0x8c, 0x16, 0x45, 0x2e, 0x62, 0x55, 0x7e, 0x1c, 0x96, + 0x1f, 0x43, 0x29, 0x3a, 0x9c, 0x9e, 0x85, 0x59, 0x3e, 0x72, 0x9b, 0x24, 0x72, 0x74, 0x03, 0x10, + 0xf5, 0x02, 0x56, 0xf1, 0xee, 0x0a, 0x37, 0x5d, 0x9c, 0x1f, 0xf3, 0x5c, 0x52, 0x0b, 0x04, 0x7c, + 0xdb, 0xcb, 0xff, 0x9d, 0x84, 0xf3, 0x19, 0x79, 0xa2, 0x35, 0x58, 0x48, 0xa0, 0x93, 0x74, 0x13, + 0xa3, 0x26, 0xc8, 0x63, 0xc2, 0x72, 0xc4, 0x82, 0xd8, 0x24, 0xe0, 0x0f, 0x6f, 0xbc, 0x09, 0xce, + 0x89, 0xcb, 0x19, 0x30, 0x45, 0x24, 0xe0, 0x55, 0xa8, 0xa1, 0xa3, 0xa8, 0xb8, 0x9a, 0x63, 0xf3, + 0x8e, 0x4b, 0x61, 0xf2, 0x64, 0x1a, 0x93, 0xef, 0x41, 0x71, 0x80, 0xc9, 0x61, 0x32, 0x81, 0x49, + 0x8e, 0x9b, 0x9c, 0xef, 0x27, 0xb3, 0x88, 0x12, 0x18, 0x37, 0xe1, 0x5c, 0xcc, 0xe7, 0x84, 0x2d, + 0x55, 0x4f, 0x1f, 0x93, 0xd8, 0x4b, 0x11, 0xb1, 0xe3, 0x48, 0x14, 0xfd, 0x42, 0x81, 0x4b, 0x71, + 0x96, 0x31, 0x66, 0x8e, 0xdb, 0x24, 0x31, 0xbf, 0xf2, 0x9c, 0x5f, 0x77, 0x32, 0x62, 0x8e, 0xe6, + 0x81, 0x5e, 0xb2, 0x46, 0xca, 0xcb, 0x26, 0xac, 0x1c, 0x32, 0x0a, 0xd1, 0x77, 0x21, 0x67, 0xe1, + 0xf6, 0xf1, 0x3e, 0x5f, 0xb8, 0x65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, 0x31, 0xfa, 0xf4, 0xc8, 0x29, 0x6b, 0x2f, 0xfb, 0x2e, 0x78, 0x07, 0xc3, 0x2a, 0xe8, 0x0f, + 0x0a, 0xcc, 0xf5, 0xdf, 0x75, 0xd1, 0xc6, 0xa8, 0xec, 0x52, 0xaf, 0xf0, 0xc5, 0xcd, 0x71, 0x4c, + 0x64, 0x39, 0x77, 0x79, 0x39, 0x1b, 0x48, 0xd3, 0x32, 0xff, 0x0b, 0x26, 0x6f, 0x7e, 0xda, 0x4b, + 0xf1, 0x71, 0x77, 0x80, 0xfe, 0xa3, 0xc0, 0xf2, 0x88, 0x7b, 0x24, 0xfa, 0x70, 0x1c, 0x74, 0x53, + 0x8a, 0xf9, 0xce, 0xb1, 0xed, 0x65, 0x65, 0x8f, 0x79, 0x65, 0x9f, 0xa0, 0x8f, 0x8e, 0xbf, 0x51, + 0x89, 0xc2, 0xd1, 0x9f, 0x14, 0x98, 0xed, 0xc3, 0x10, 0xdd, 0x3a, 0x32, 0xdc, 0x61, 0x4d, 0x1b, + 0x63, 0x58, 0xc8, 0x2a, 0xb6, 0x79, 0x15, 0xf7, 0xd1, 0xbd, 0x23, 0xed, 0x0f, 0xdf, 0x9e, 0xc1, + 0x9b, 0xed, 0x41, 0xf5, 0xfb, 0x5f, 0xbc, 0x2d, 0x29, 0x5f, 0xbe, 0x2d, 0x29, 0xff, 0x78, 0x5b, + 0x52, 0x7e, 0xfd, 0xae, 0x74, 0xea, 0xcb, 0x77, 0xa5, 0x53, 0x7f, 0x7f, 0x57, 0x3a, 0xf5, 0xc3, + 0x23, 0x0c, 0xd2, 0x5e, 0x32, 0x22, 0x9f, 0xaa, 0x8d, 0x3c, 0xff, 0x03, 0x7c, 0xfb, 0xff, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x78, 0x4e, 0x15, 0x86, 0x4b, 0x17, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1377,6 +1483,8 @@ type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // ParamsByVersion queries the parameters of the module for a specific version of past params. ParamsByVersion(ctx context.Context, in *QueryParamsByVersionRequest, opts ...grpc.CallOption) (*QueryParamsByVersionResponse, error) + // ParamsByBTCHeight queries the parameters of the module for a specific BTC height + ParamsByBTCHeight(ctx context.Context, in *QueryParamsByBTCHeightRequest, opts ...grpc.CallOption) (*QueryParamsByBTCHeightResponse, error) // FinalityProviders queries all finality providers FinalityProviders(ctx context.Context, in *QueryFinalityProvidersRequest, opts ...grpc.CallOption) (*QueryFinalityProvidersResponse, error) // FinalityProvider info about one finality provider @@ -1415,6 +1523,15 @@ func (c *queryClient) ParamsByVersion(ctx context.Context, in *QueryParamsByVers return out, nil } +func (c *queryClient) ParamsByBTCHeight(ctx context.Context, in *QueryParamsByBTCHeightRequest, opts ...grpc.CallOption) (*QueryParamsByBTCHeightResponse, error) { + out := new(QueryParamsByBTCHeightResponse) + err := c.cc.Invoke(ctx, "/babylon.btcstaking.v1.Query/ParamsByBTCHeight", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) FinalityProviders(ctx context.Context, in *QueryFinalityProvidersRequest, opts ...grpc.CallOption) (*QueryFinalityProvidersResponse, error) { out := new(QueryFinalityProvidersResponse) err := c.cc.Invoke(ctx, "/babylon.btcstaking.v1.Query/FinalityProviders", in, out, opts...) @@ -1466,6 +1583,8 @@ type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // ParamsByVersion queries the parameters of the module for a specific version of past params. ParamsByVersion(context.Context, *QueryParamsByVersionRequest) (*QueryParamsByVersionResponse, error) + // ParamsByBTCHeight queries the parameters of the module for a specific BTC height + ParamsByBTCHeight(context.Context, *QueryParamsByBTCHeightRequest) (*QueryParamsByBTCHeightResponse, error) // FinalityProviders queries all finality providers FinalityProviders(context.Context, *QueryFinalityProvidersRequest) (*QueryFinalityProvidersResponse, error) // FinalityProvider info about one finality provider @@ -1488,6 +1607,9 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) ParamsByVersion(ctx context.Context, req *QueryParamsByVersionRequest) (*QueryParamsByVersionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ParamsByVersion not implemented") } +func (*UnimplementedQueryServer) ParamsByBTCHeight(ctx context.Context, req *QueryParamsByBTCHeightRequest) (*QueryParamsByBTCHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ParamsByBTCHeight not implemented") +} func (*UnimplementedQueryServer) FinalityProviders(ctx context.Context, req *QueryFinalityProvidersRequest) (*QueryFinalityProvidersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FinalityProviders not implemented") } @@ -1544,6 +1666,24 @@ func _Query_ParamsByVersion_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Query_ParamsByBTCHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsByBTCHeightRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ParamsByBTCHeight(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.btcstaking.v1.Query/ParamsByBTCHeight", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ParamsByBTCHeight(ctx, req.(*QueryParamsByBTCHeightRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_FinalityProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryFinalityProvidersRequest) if err := dec(in); err != nil { @@ -1646,6 +1786,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ParamsByVersion", Handler: _Query_ParamsByVersion_Handler, }, + { + MethodName: "ParamsByBTCHeight", + Handler: _Query_ParamsByBTCHeight_Handler, + }, { MethodName: "FinalityProviders", Handler: _Query_FinalityProviders_Handler, @@ -1788,6 +1932,72 @@ func (m *QueryParamsByVersionResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *QueryParamsByBTCHeightRequest) 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 *QueryParamsByBTCHeightRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsByBTCHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BtcHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BtcHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsByBTCHeightResponse) 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 *QueryParamsByBTCHeightResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsByBTCHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Version != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *QueryFinalityProvidersRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2654,6 +2864,32 @@ func (m *QueryParamsByVersionResponse) Size() (n int) { return n } +func (m *QueryParamsByBTCHeightRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BtcHeight != 0 { + n += 1 + sovQuery(uint64(m.BtcHeight)) + } + return n +} + +func (m *QueryParamsByBTCHeightResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.Version != 0 { + n += 1 + sovQuery(uint64(m.Version)) + } + return n +} + func (m *QueryFinalityProvidersRequest) Size() (n int) { if m == nil { return 0 @@ -3282,6 +3518,177 @@ func (m *QueryParamsByVersionResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryParamsByBTCHeightRequest) 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 ErrIntOverflowQuery + } + 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: QueryParamsByBTCHeightRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsByBTCHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcHeight", wireType) + } + m.BtcHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BtcHeight |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsByBTCHeightResponse) 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 ErrIntOverflowQuery + } + 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: QueryParamsByBTCHeightResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsByBTCHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryFinalityProvidersRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/btcstaking/types/query.pb.gw.go b/x/btcstaking/types/query.pb.gw.go index aa5969378..54013e45c 100644 --- a/x/btcstaking/types/query.pb.gw.go +++ b/x/btcstaking/types/query.pb.gw.go @@ -105,6 +105,60 @@ func local_request_Query_ParamsByVersion_0(ctx context.Context, marshaler runtim } +func request_Query_ParamsByBTCHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsByBTCHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["btc_height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "btc_height") + } + + protoReq.BtcHeight, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "btc_height", err) + } + + msg, err := client.ParamsByBTCHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ParamsByBTCHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsByBTCHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["btc_height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "btc_height") + } + + protoReq.BtcHeight, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "btc_height", err) + } + + msg, err := server.ParamsByBTCHeight(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_Query_FinalityProviders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -451,6 +505,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_ParamsByBTCHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ParamsByBTCHeight_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ParamsByBTCHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_FinalityProviders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -647,6 +724,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_ParamsByBTCHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ParamsByBTCHeight_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ParamsByBTCHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_FinalityProviders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -755,6 +852,8 @@ var ( pattern_Query_ParamsByVersion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "btcstaking", "v1", "params", "version"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ParamsByBTCHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 4}, []string{"babylon", "btcstaking", "v1", "params", "btc_height"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_FinalityProviders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "btcstaking", "v1", "finality_providers"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_FinalityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"babylon", "btcstaking", "v1", "finality_providers", "fp_btc_pk_hex", "finality_provider"}, "", runtime.AssumeColonVerbOpt(false))) @@ -771,6 +870,8 @@ var ( forward_Query_ParamsByVersion_0 = runtime.ForwardResponseMessage + forward_Query_ParamsByBTCHeight_0 = runtime.ForwardResponseMessage + forward_Query_FinalityProviders_0 = runtime.ForwardResponseMessage forward_Query_FinalityProvider_0 = runtime.ForwardResponseMessage