Skip to content

Commit

Permalink
fix: update params breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwbabylonlab committed Dec 5, 2024
1 parent b4c9b7d commit 32ff8ad
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
30 changes: 16 additions & 14 deletions internal/indexer/db/client/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ type IndexerGlobalParamsDocument struct {
Params interface{} `bson:"params"`
}


type IndexerBbnStakingParamsDocument struct {
CovenantPks []string `bson:"covenant_pks"`
CovenantQuorum uint32 `bson:"covenant_quorum"`
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion internal/shared/utils/datagen/datagen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
}
}

Expand Down

0 comments on commit 32ff8ad

Please sign in to comment.