From 32ff8ad627f17693e8c2f24c41b5a5fcf6ae372a Mon Sep 17 00:00:00 2001 From: wjrjerome Date: Thu, 5 Dec 2024 16:44:59 +1100 Subject: [PATCH] fix: update params breaking changes --- go.mod | 2 +- go.sum | 6 ++-- internal/indexer/db/client/params.go | 30 ++++++++++--------- .../db/model/{global_params.go => params.go} | 5 ++-- .../types/{global_params.go => bbn_params.go} | 4 ++- internal/shared/utils/datagen/datagen.go | 3 +- 6 files changed, 27 insertions(+), 23 deletions(-) rename internal/indexer/db/model/{global_params.go => params.go} (86%) rename internal/indexer/types/{global_params.go => bbn_params.go} (86%) diff --git a/go.mod b/go.mod index 07516fa..c834923 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23.1 toolchain go1.23.3 require ( - github.com/babylonlabs-io/babylon v0.17.2 + github.com/babylonlabs-io/babylon v0.18.0 github.com/babylonlabs-io/networks/parameters v0.2.2 github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241203052145-e50972fc19c9 github.com/btcsuite/btcd v0.24.2 diff --git a/go.sum b/go.sum index 7492997..a6d5c73 100644 --- a/go.sum +++ b/go.sum @@ -83,12 +83,10 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.44.312 h1:llrElfzeqG/YOLFFKjg1xNpZCFJ2xraIi3PqSuP+95k= github.com/aws/aws-sdk-go v1.44.312/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/babylonlabs-io/babylon v0.17.2 h1:CzBXYFOZLg3+ijfqIsisETAzRVp5AGKNO2FG63w0HUo= -github.com/babylonlabs-io/babylon v0.17.2/go.mod h1:sT+KG2U+M0tDMNZZ2L5CwlXX0OpagGEs56BiWXqaZFw= +github.com/babylonlabs-io/babylon v0.18.0 h1:phMY/GiR9N5MpD3XCmvyPpZkc1I3kTM9yX+Cf0h3OnU= +github.com/babylonlabs-io/babylon v0.18.0/go.mod h1:sT+KG2U+M0tDMNZZ2L5CwlXX0OpagGEs56BiWXqaZFw= github.com/babylonlabs-io/networks/parameters v0.2.2 h1:TCu39fZvjX5f6ZZrjhYe54M6wWxglNewuKu56yE+zrc= github.com/babylonlabs-io/networks/parameters v0.2.2/go.mod h1:iEJVOzaLsE33vpP7J4u+CRGfkSIfErUAwRmgCFCBpyI= -github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241129112518-b417aa03ec62 h1:lMj/YjQMUCaynl4EBOZIqQNvTX7muiNKhHeell2PRU4= -github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241129112518-b417aa03ec62/go.mod h1:n3fr3c+9LNiJlyETmcrVk94Zn76rAADhGZKxX+rVf+Q= github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241203052145-e50972fc19c9 h1:4UGpRPm5oxj3P8QNrGrkiQtlQYTAgsWzXJFi8oD7zpY= github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241203052145-e50972fc19c9/go.mod h1:n3fr3c+9LNiJlyETmcrVk94Zn76rAADhGZKxX+rVf+Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= diff --git a/internal/indexer/db/client/params.go b/internal/indexer/db/client/params.go index 5390713..a897cee 100644 --- a/internal/indexer/db/client/params.go +++ b/internal/indexer/db/client/params.go @@ -36,21 +36,23 @@ func (db *IndexerDatabase) GetBbnStakingParams(ctx context.Context) ([]*indexert } bbnParams := &indexertypes.BbnStakingParams{ - Version: model.Version, - CovenantPks: stakingParams.CovenantPks, - CovenantQuorum: stakingParams.CovenantQuorum, - MinStakingValueSat: stakingParams.MinStakingValueSat, - MaxStakingValueSat: stakingParams.MaxStakingValueSat, - MinStakingTimeBlocks: stakingParams.MinStakingTimeBlocks, - MaxStakingTimeBlocks: stakingParams.MaxStakingTimeBlocks, - SlashingPkScript: stakingParams.SlashingPkScript, - MinSlashingTxFeeSat: stakingParams.MinSlashingTxFeeSat, - SlashingRate: stakingParams.SlashingRate, - MinUnbondingTimeBlocks: stakingParams.MinUnbondingTimeBlocks, - UnbondingFeeSat: stakingParams.UnbondingFeeSat, - MinCommissionRate: stakingParams.MinCommissionRate, - MaxActiveFinalityProviders: stakingParams.MaxActiveFinalityProviders, + Version: model.Version, + CovenantPks: stakingParams.CovenantPks, + CovenantQuorum: stakingParams.CovenantQuorum, + MinStakingValueSat: stakingParams.MinStakingValueSat, + MaxStakingValueSat: stakingParams.MaxStakingValueSat, + MinStakingTimeBlocks: stakingParams.MinStakingTimeBlocks, + MaxStakingTimeBlocks: stakingParams.MaxStakingTimeBlocks, + SlashingPkScript: stakingParams.SlashingPkScript, + MinSlashingTxFeeSat: stakingParams.MinSlashingTxFeeSat, + SlashingRate: stakingParams.SlashingRate, + UnbondingTimeBlocks: stakingParams.UnbondingTimeBlocks, + UnbondingFeeSat: stakingParams.UnbondingFeeSat, + MinCommissionRate: stakingParams.MinCommissionRate, + MaxActiveFinalityProviders: stakingParams.MaxActiveFinalityProviders, DelegationCreationBaseGasFee: stakingParams.DelegationCreationBaseGasFee, + AllowListExpirationHeight: stakingParams.AllowListExpirationHeight, + BtcActivationHeight: stakingParams.BtcActivationHeight, } params = append(params, bbnParams) diff --git a/internal/indexer/db/model/global_params.go b/internal/indexer/db/model/params.go similarity index 86% rename from internal/indexer/db/model/global_params.go rename to internal/indexer/db/model/params.go index c5ea749..498f1b8 100644 --- a/internal/indexer/db/model/global_params.go +++ b/internal/indexer/db/model/params.go @@ -10,7 +10,6 @@ type IndexerGlobalParamsDocument struct { Params interface{} `bson:"params"` } - type IndexerBbnStakingParamsDocument struct { CovenantPks []string `bson:"covenant_pks"` CovenantQuorum uint32 `bson:"covenant_quorum"` @@ -21,11 +20,13 @@ type IndexerBbnStakingParamsDocument struct { SlashingPkScript string `bson:"slashing_pk_script"` MinSlashingTxFeeSat int64 `bson:"min_slashing_tx_fee_sat"` SlashingRate string `bson:"slashing_rate"` - MinUnbondingTimeBlocks uint32 `bson:"min_unbonding_time_blocks"` + UnbondingTimeBlocks uint32 `bson:"unbonding_time_blocks"` UnbondingFeeSat int64 `bson:"unbonding_fee_sat"` MinCommissionRate string `bson:"min_commission_rate"` MaxActiveFinalityProviders uint32 `bson:"max_active_finality_providers"` DelegationCreationBaseGasFee uint64 `bson:"delegation_creation_base_gas_fee"` + AllowListExpirationHeight uint64 `bson:"allow_list_expiration_height"` + BtcActivationHeight uint32 `bson:"btc_activation_height"` } type IndexerBtcCheckpointParamsDocument struct { diff --git a/internal/indexer/types/global_params.go b/internal/indexer/types/bbn_params.go similarity index 86% rename from internal/indexer/types/global_params.go rename to internal/indexer/types/bbn_params.go index 0041f1f..a502bb5 100644 --- a/internal/indexer/types/global_params.go +++ b/internal/indexer/types/bbn_params.go @@ -19,11 +19,13 @@ type BbnStakingParams struct { SlashingPkScript string `json:"slashing_pk_script"` MinSlashingTxFeeSat int64 `json:"min_slashing_tx_fee_sat"` SlashingRate string `json:"slashing_rate"` - MinUnbondingTimeBlocks uint32 `json:"min_unbonding_time_blocks"` + UnbondingTimeBlocks uint32 `json:"unbonding_time_blocks"` UnbondingFeeSat int64 `json:"unbonding_fee_sat"` MinCommissionRate string `json:"min_commission_rate"` MaxActiveFinalityProviders uint32 `json:"max_active_finality_providers"` DelegationCreationBaseGasFee uint64 `json:"delegation_creation_base_gas_fee"` + AllowListExpirationHeight uint64 `json:"allow_list_expiration_height"` + BtcActivationHeight uint32 `json:"btc_activation_height"` } type BtcCheckpointParams struct { diff --git a/internal/shared/utils/datagen/datagen.go b/internal/shared/utils/datagen/datagen.go index ace54ea..5dbab00 100644 --- a/internal/shared/utils/datagen/datagen.go +++ b/internal/shared/utils/datagen/datagen.go @@ -187,11 +187,12 @@ func GenerateRandomBabylonParams(r *rand.Rand) indexertypes.BbnStakingParams { SlashingPkScript: RandomString(r, 10), MinSlashingTxFeeSat: int64(r.Intn(10)), SlashingRate: fmt.Sprintf("%f", RandomPostiveFloat64(r)), - MinUnbondingTimeBlocks: uint32(r.Intn(10)), + UnbondingTimeBlocks: uint32(r.Intn(10)), UnbondingFeeSat: int64(r.Intn(10)), MinCommissionRate: fmt.Sprintf("%f", RandomPostiveFloat64(r)), MaxActiveFinalityProviders: uint32(r.Intn(10)), DelegationCreationBaseGasFee: uint64(r.Intn(10)), + BtcActivationHeight: uint32(r.Intn(10)), } }