Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: broken staking and unbonding timelock value #174

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,12 @@ const docTemplate = `{
"indexertypes.BbnStakingParams": {
"type": "object",
"properties": {
"allow_list_expiration_height": {
"type": "integer"
},
"btc_activation_height": {
"type": "integer"
},
"covenant_pks": {
"type": "array",
"items": {
Expand Down Expand Up @@ -837,9 +843,6 @@ const docTemplate = `{
"min_staking_value_sat": {
"type": "integer"
},
"min_unbonding_time_blocks": {
"type": "integer"
},
"slashing_pk_script": {
"type": "string"
},
Expand All @@ -849,6 +852,9 @@ const docTemplate = `{
"unbonding_fee_sat": {
"type": "integer"
},
"unbonding_time_blocks": {
"type": "integer"
},
"version": {
"type": "integer"
}
Expand Down Expand Up @@ -1208,8 +1214,8 @@ const docTemplate = `{
"staking_amount": {
"type": "integer"
},
"staking_time": {
"type": "string"
"staking_timelock": {
"type": "integer"
},
"staking_tx_hash_hex": {
"type": "string"
Expand All @@ -1234,8 +1240,8 @@ const docTemplate = `{
"slashing_tx_hex": {
"type": "string"
},
"unbonding_time": {
"type": "string"
"unbonding_timelock": {
"type": "integer"
},
"unbonding_tx": {
"type": "string"
Expand Down
20 changes: 13 additions & 7 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,12 @@
"indexertypes.BbnStakingParams": {
"type": "object",
"properties": {
"allow_list_expiration_height": {
"type": "integer"
},
"btc_activation_height": {
"type": "integer"
},
"covenant_pks": {
"type": "array",
"items": {
Expand Down Expand Up @@ -829,9 +835,6 @@
"min_staking_value_sat": {
"type": "integer"
},
"min_unbonding_time_blocks": {
"type": "integer"
},
"slashing_pk_script": {
"type": "string"
},
Expand All @@ -841,6 +844,9 @@
"unbonding_fee_sat": {
"type": "integer"
},
"unbonding_time_blocks": {
"type": "integer"
},
"version": {
"type": "integer"
}
Expand Down Expand Up @@ -1200,8 +1206,8 @@
"staking_amount": {
"type": "integer"
},
"staking_time": {
"type": "string"
"staking_timelock": {
"type": "integer"
},
"staking_tx_hash_hex": {
"type": "string"
Expand All @@ -1226,8 +1232,8 @@
"slashing_tx_hex": {
"type": "string"
},
"unbonding_time": {
"type": "string"
"unbonding_timelock": {
"type": "integer"
},
"unbonding_tx": {
"type": "string"
Expand Down
16 changes: 10 additions & 6 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ definitions:
type: object
indexertypes.BbnStakingParams:
properties:
allow_list_expiration_height:
type: integer
btc_activation_height:
type: integer
covenant_pks:
items:
type: string
Expand All @@ -129,14 +133,14 @@ definitions:
type: integer
min_staking_value_sat:
type: integer
min_unbonding_time_blocks:
type: integer
slashing_pk_script:
type: string
slashing_rate:
type: string
unbonding_fee_sat:
type: integer
unbonding_time_blocks:
type: integer
version:
type: integer
type: object
Expand Down Expand Up @@ -376,8 +380,8 @@ definitions:
type: string
staking_amount:
type: integer
staking_time:
type: string
staking_timelock:
type: integer
staking_tx_hash_hex:
type: string
staking_tx_hex:
Expand All @@ -393,8 +397,8 @@ definitions:
type: array
slashing_tx_hex:
type: string
unbonding_time:
type: string
unbonding_timelock:
type: integer
unbonding_tx:
type: string
type: object
Expand Down
4 changes: 2 additions & 2 deletions internal/indexer/db/model/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ type IndexerDelegationDetails struct {
ParamsVersion uint32 `bson:"params_version"`
FinalityProviderBtcPksHex []string `bson:"finality_provider_btc_pks_hex"`
StakerBtcPkHex string `bson:"staker_btc_pk_hex"`
StakingTime uint32 `bson:"staking_time"`
StakingTimeLock uint32 `bson:"staking_time"`
StakingAmount uint64 `bson:"staking_amount"`
StakingOutputPkScript string `bson:"staking_output_pk_script"`
StakingOutputIdx uint32 `bson:"staking_output_idx"`
UnbondingTime uint32 `bson:"unbonding_time"`
UnbondingTimeLock uint32 `bson:"unbonding_time"`
UnbondingTx string `bson:"unbonding_tx"`
State indexertypes.DelegationState `bson:"state"`
SubState indexertypes.DelegationSubState `bson:"sub_state,omitempty"`
Expand Down
10 changes: 5 additions & 5 deletions internal/v2/service/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
type DelegationStaking struct {
StakingTxHashHex string `json:"staking_tx_hash_hex"`
StakingTxHex string `json:"staking_tx_hex"`
StakingTime string `json:"staking_time"`
StakingTimelock uint32 `json:"staking_timelock"`
StakingAmount uint64 `json:"staking_amount"`
StartHeight uint32 `json:"start_height,omitempty"`
EndHeight uint32 `json:"end_height,omitempty"`
Expand All @@ -30,7 +30,7 @@ type CovenantSignature struct {
}

type DelegationUnbonding struct {
UnbondingTime string `json:"unbonding_time"`
UnbondingTimelock uint32 `json:"unbonding_timelock"`
UnbondingTx string `json:"unbonding_tx"`
CovenantUnbondingSignatures []CovenantSignature `json:"covenant_unbonding_signatures"`
SlashingTxHex string `json:"slashing_tx_hex"`
Expand Down Expand Up @@ -62,7 +62,7 @@ func FromDelegationDocument(delegation indexerdbmodel.IndexerDelegationDetails)
DelegationStaking: DelegationStaking{
StakingTxHashHex: delegation.StakingTxHashHex,
StakingTxHex: delegation.StakingTxHex,
StakingTime: utils.ParseTimestampToIsoFormat(int64(delegation.StakingTime)),
StakingTimelock: delegation.StakingTimeLock,
StakingAmount: delegation.StakingAmount,
StartHeight: delegation.StartHeight,
EndHeight: delegation.EndHeight,
Expand All @@ -73,8 +73,8 @@ func FromDelegationDocument(delegation indexerdbmodel.IndexerDelegationDetails)
SlashingTxHex: delegation.SlashingTxHex,
},
DelegationUnbonding: DelegationUnbonding{
UnbondingTime: utils.ParseTimestampToIsoFormat(int64(delegation.UnbondingTime)),
UnbondingTx: delegation.UnbondingTx,
UnbondingTimelock: delegation.UnbondingTimeLock,
UnbondingTx: delegation.UnbondingTx,
CovenantUnbondingSignatures: getUnbondingSignatures(
delegation.CovenantUnbondingSignatures,
),
Expand Down
Loading