From e12d0ef4d5ecc95a812e7eef89bd42e7a15a7b8f Mon Sep 17 00:00:00 2001 From: Cirrus Gai Date: Fri, 25 Oct 2024 18:10:38 +0800 Subject: [PATCH] backport: Insert inclusion height to early unbonding event (#230) --- CHANGELOG.md | 4 + proto/babylon/btcstaking/v1/btcstaking.proto | 3 - proto/babylon/btcstaking/v1/events.proto | 4 +- x/btcstaking/keeper/msg_server.go | 18 +- x/btcstaking/keeper/power_dist_change.go | 6 +- x/btcstaking/types/btcstaking.pb.go | 3 - x/btcstaking/types/events.go | 55 +++-- x/btcstaking/types/events.pb.go | 212 ++++++++++++------- x/btcstaking/types/query.go | 2 +- 9 files changed, 193 insertions(+), 114 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 300970f62..a4646d52a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## Unreleased +### API Breaking + +* [#228](https://github.com/babylonlabs-io/babylon/pull/228) Add inclusion height to early unbonding event + ## v0.14.0 ### State Machine Breaking diff --git a/proto/babylon/btcstaking/v1/btcstaking.proto b/proto/babylon/btcstaking/v1/btcstaking.proto index 564f7b738..23d1fcf83 100644 --- a/proto/babylon/btcstaking/v1/btcstaking.proto +++ b/proto/babylon/btcstaking/v1/btcstaking.proto @@ -112,9 +112,6 @@ message BTCDelegation { // DelegatorUnbondingInfo contains the information about transaction which spent // the staking output. It contains: // - spend_stake_tx: the transaction which spent the staking output -// - spend_stake_tx_inclusion_block_hash: the block hash of the block in which -// spend_stake_tx was included -// - spend_stake_tx_sig_inclusion_index: the index of spend_stake_tx in the block message DelegatorUnbondingInfo { // spend_stake_tx is the transaction which spent the staking output. It is // filled only if spend_stake_tx is different than unbonding_tx registered diff --git a/proto/babylon/btcstaking/v1/events.proto b/proto/babylon/btcstaking/v1/events.proto index 235b8b473..3815c6a6a 100644 --- a/proto/babylon/btcstaking/v1/events.proto +++ b/proto/babylon/btcstaking/v1/events.proto @@ -215,8 +215,10 @@ message EventBTCDelgationUnbondedEarly { // staking_tx_hash is the hash of the staking tx. // It uniquely identifies a BTC delegation string staking_tx_hash = 1 [(amino.dont_omitempty) = true]; + // start_height is the start BTC height of the early unbonding + string start_height = 2 [(amino.dont_omitempty) = true]; // new_state of the BTC delegation - string new_state = 2 [(amino.dont_omitempty) = true]; + string new_state = 3 [(amino.dont_omitempty) = true]; } // EventBTCDelegationExpired is the event emitted when a BTC delegation diff --git a/x/btcstaking/keeper/msg_server.go b/x/btcstaking/keeper/msg_server.go index 2b4281a33..3871ecbfa 100644 --- a/x/btcstaking/keeper/msg_server.go +++ b/x/btcstaking/keeper/msg_server.go @@ -581,6 +581,8 @@ func (ms msgServer) BTCUndelegate(goCtx context.Context, req *types.MsgBTCUndele // we do not need to save it in the database SpendStakeTx: []byte{}, } + + types.EmitEarlyUnbondedEvent(ctx, btcDel.MustGetStakingTxHash().String(), stakerSpendigTxHeader.Height) } else { // stakeSpendingTx is not unbonding tx, first we need to verify whether it // acutally spends staking output @@ -599,16 +601,12 @@ func (ms msgServer) BTCUndelegate(goCtx context.Context, req *types.MsgBTCUndele SpendStakeTx: req.StakeSpendingTx, } - ev := &types.EventUnexpectedUnbondingTx{ - StakingTxHash: btcDel.MustGetStakingTxHash().String(), - SpendStakeTxHash: spendStakeTxHash.String(), - SpendStakeTxHeaderHash: req.StakeSpendingTxInclusionProof.Key.Hash.MarshalHex(), - SpendStakeTxBlockIndex: req.StakeSpendingTxInclusionProof.Key.Index, - } - - if err := ctx.EventManager().EmitTypedEvent(ev); err != nil { - panic(fmt.Errorf("failed to emit EventUnexpectedUnbondingTx event: %w", err)) - } + types.EmitUnexpectedUnbondingTxEvent(ctx, + btcDel.MustGetStakingTxHash().String(), + spendStakeTxHash.String(), + req.StakeSpendingTxInclusionProof.Key.Hash.MarshalHex(), + req.StakeSpendingTxInclusionProof.Key.Index, + ) } // all good, add the signature to BTC delegation's undelegation diff --git a/x/btcstaking/keeper/power_dist_change.go b/x/btcstaking/keeper/power_dist_change.go index 0d051ff7e..3c2c28750 100644 --- a/x/btcstaking/keeper/power_dist_change.go +++ b/x/btcstaking/keeper/power_dist_change.go @@ -188,8 +188,10 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( activeBTCDels[fpBTCPKHex] = append(activeBTCDels[fpBTCPKHex], btcDel) } } else if delEvent.NewState == types.BTCDelegationStatus_UNBONDED { - // emit event about this unbonded BTC delegation - types.EmitUnbondedBTCDelEvent(sdkCtx, delEvent.StakingTxHash, btcDel.IsUnbondedEarly()) + // emit expired event if it is not early unbonding + if !btcDel.IsUnbondedEarly() { + types.EmitExpiredDelegationEvent(sdkCtx, delEvent.StakingTxHash) + } // add the unbonded BTC delegation to the map unbondedBTCDels[delEvent.StakingTxHash] = struct{}{} } diff --git a/x/btcstaking/types/btcstaking.pb.go b/x/btcstaking/types/btcstaking.pb.go index 0b7f89bd0..3dbd9bd01 100644 --- a/x/btcstaking/types/btcstaking.pb.go +++ b/x/btcstaking/types/btcstaking.pb.go @@ -440,9 +440,6 @@ func (m *BTCDelegation) GetParamsVersion() uint32 { // DelegatorUnbondingInfo contains the information about transaction which spent // the staking output. It contains: // - spend_stake_tx: the transaction which spent the staking output -// - spend_stake_tx_inclusion_block_hash: the block hash of the block in which -// spend_stake_tx was included -// - spend_stake_tx_sig_inclusion_index: the index of spend_stake_tx in the block type DelegatorUnbondingInfo struct { // spend_stake_tx is the transaction which spent the staking output. It is // filled only if spend_stake_tx is different than unbonding_tx registered diff --git a/x/btcstaking/types/events.go b/x/btcstaking/types/events.go index df19b7b04..268fe2d45 100644 --- a/x/btcstaking/types/events.go +++ b/x/btcstaking/types/events.go @@ -5,8 +5,9 @@ import ( "fmt" "strconv" - bbn "github.com/babylonlabs-io/babylon/types" sdk "github.com/cosmos/cosmos-sdk/types" + + bbn "github.com/babylonlabs-io/babylon/types" ) func NewEventPowerDistUpdateWithBTCDel(ev *EventBTCDelegationStateUpdate) *EventPowerDistUpdate { @@ -127,9 +128,11 @@ func NewCovenantQuorumReachedEvent( func NewDelegationUnbondedEarlyEvent( stakingTxHash string, + startHeight uint32, ) *EventBTCDelgationUnbondedEarly { return &EventBTCDelgationUnbondedEarly{ StakingTxHash: stakingTxHash, + StartHeight: strconv.FormatUint(uint64(startHeight), 10), NewState: BTCDelegationStatus_UNBONDED.String(), } } @@ -153,19 +156,43 @@ func NewFinalityProviderStatusChangeEvent( } } -// EmitUnbondedBTCDelEvent emits events for an unbonded BTC delegations -func EmitUnbondedBTCDelEvent(sdkCtx sdk.Context, stakingTxHash string, unbondedEarly bool) { - // delegation expired and become unbonded emit block event about this information - if unbondedEarly { - unbondedEarlyEvent := NewDelegationUnbondedEarlyEvent(stakingTxHash) - if err := sdkCtx.EventManager().EmitTypedEvent(unbondedEarlyEvent); err != nil { - panic(fmt.Errorf("failed to emit event the new unbonded BTC delegation: %w", err)) - } - } else { - expiredEvent := NewExpiredDelegationEvent(stakingTxHash) - if err := sdkCtx.EventManager().EmitTypedEvent(expiredEvent); err != nil { - panic(fmt.Errorf("failed to emit event for the new expired BTC delegation: %w", err)) - } +func NewUnexpectedUnbondingTxEvent( + stakingTxHash, spendStakeTxHash, spendStakeTxHeaderHash string, + spendStakeTxBlockIndex uint32, +) *EventUnexpectedUnbondingTx { + return &EventUnexpectedUnbondingTx{ + StakingTxHash: stakingTxHash, + SpendStakeTxHash: spendStakeTxHash, + SpendStakeTxHeaderHash: spendStakeTxHeaderHash, + SpendStakeTxBlockIndex: spendStakeTxBlockIndex, + } +} + +// EmitUnexpectedUnbondingTxEvent emits events for an unexpected unbonding tx +func EmitUnexpectedUnbondingTxEvent( + sdkCtx sdk.Context, + stakingTxHash, spendStakeTxHash, spendStakeTxHeaderHash string, + spendStakeTxBlockIndex uint32, +) { + ev := NewUnexpectedUnbondingTxEvent(stakingTxHash, spendStakeTxHash, spendStakeTxHeaderHash, spendStakeTxBlockIndex) + if err := sdkCtx.EventManager().EmitTypedEvent(ev); err != nil { + panic(fmt.Errorf("failed to emit event the unexpected unbonding tx event: %w", err)) + } +} + +// EmitEarlyUnbondedEvent emits events for an early unbonded BTC delegation +func EmitEarlyUnbondedEvent(sdkCtx sdk.Context, stakingTxHash string, inclusionHeight uint32) { + ev := NewDelegationUnbondedEarlyEvent(stakingTxHash, inclusionHeight) + if err := sdkCtx.EventManager().EmitTypedEvent(ev); err != nil { + panic(fmt.Errorf("failed to emit event the early unbonded BTC delegation: %w", err)) + } +} + +// EmitExpiredDelegationEvent emits events for an expired delegation +func EmitExpiredDelegationEvent(sdkCtx sdk.Context, stakingTxHash string) { + ev := NewExpiredDelegationEvent(stakingTxHash) + if err := sdkCtx.EventManager().EmitTypedEvent(ev); err != nil { + panic(fmt.Errorf("failed to emit event the expired BTC delegation: %w", err)) } } diff --git a/x/btcstaking/types/events.pb.go b/x/btcstaking/types/events.pb.go index ea8bd83b7..9f371dfba 100644 --- a/x/btcstaking/types/events.pb.go +++ b/x/btcstaking/types/events.pb.go @@ -1032,8 +1032,10 @@ type EventBTCDelgationUnbondedEarly struct { // staking_tx_hash is the hash of the staking tx. // It uniquely identifies a BTC delegation StakingTxHash string `protobuf:"bytes,1,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` + // start_height is the start BTC height of the early unbonding + StartHeight string `protobuf:"bytes,2,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` // new_state of the BTC delegation - NewState string `protobuf:"bytes,2,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` + NewState string `protobuf:"bytes,3,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` } func (m *EventBTCDelgationUnbondedEarly) Reset() { *m = EventBTCDelgationUnbondedEarly{} } @@ -1076,6 +1078,13 @@ func (m *EventBTCDelgationUnbondedEarly) GetStakingTxHash() string { return "" } +func (m *EventBTCDelgationUnbondedEarly) GetStartHeight() string { + if m != nil { + return m.StartHeight + } + return "" +} + func (m *EventBTCDelgationUnbondedEarly) GetNewState() string { if m != nil { return m.NewState @@ -1240,85 +1249,85 @@ func init() { } var fileDescriptor_74118427820fff75 = []byte{ - // 1234 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4b, 0x6f, 0xdb, 0x46, - 0x10, 0xb6, 0x24, 0x3f, 0xd7, 0x79, 0x38, 0x6c, 0x1a, 0xc8, 0x6a, 0xa2, 0x38, 0xca, 0x03, 0x6e, - 0xd0, 0x48, 0x79, 0xf8, 0xd0, 0xab, 0x64, 0xcb, 0x91, 0x52, 0xc3, 0x55, 0x25, 0x3b, 0x40, 0x7b, - 0x21, 0x96, 0xe4, 0x58, 0xda, 0x8a, 0xda, 0x25, 0xb8, 0x4b, 0x59, 0xba, 0x17, 0xe8, 0x35, 0xe7, - 0xfe, 0x82, 0xde, 0xda, 0x7f, 0xd1, 0x5e, 0x0a, 0xe4, 0x52, 0xa0, 0xe8, 0xa1, 0x28, 0xe2, 0x43, - 0xff, 0x45, 0x51, 0x70, 0x77, 0x49, 0x89, 0x36, 0x95, 0xd8, 0x45, 0x72, 0x11, 0xb4, 0x3b, 0xdf, - 0xcc, 0xb7, 0xf3, 0xcd, 0xec, 0x2c, 0x88, 0x4a, 0x16, 0xb6, 0xc6, 0x2e, 0xa3, 0x15, 0x4b, 0xd8, - 0x5c, 0xe0, 0x3e, 0xa1, 0xdd, 0xca, 0xf0, 0x49, 0x05, 0x86, 0x40, 0x05, 0x2f, 0x7b, 0x3e, 0x13, - 0xcc, 0xf8, 0x58, 0x63, 0xca, 0x13, 0x4c, 0x79, 0xf8, 0xa4, 0x70, 0xbd, 0xcb, 0xba, 0x4c, 0x22, - 0x2a, 0xe1, 0x3f, 0x05, 0x2e, 0xdc, 0xb3, 0x19, 0x1f, 0x30, 0x5e, 0x99, 0x04, 0xb3, 0x40, 0xe0, - 0x27, 0xd1, 0x5a, 0xa3, 0x1e, 0xa4, 0xd3, 0x4e, 0x11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bc, 0x91, 0x70, 0x96, 0xa8, 0x19, 0x21, 0x2c, 0x97, 0xd9, 0x7d, - 0x93, 0x50, 0x47, 0xcf, 0xb4, 0xcb, 0xa9, 0x21, 0x6a, 0x21, 0xaa, 0x19, 0x82, 0x1e, 0xfe, 0x94, - 0x41, 0x37, 0xd2, 0x1f, 0x0d, 0xe3, 0x3e, 0xba, 0xb3, 0xdb, 0xdc, 0xaf, 0xee, 0x35, 0x0f, 0xbe, - 0x36, 0x5b, 0xed, 0x2f, 0x5f, 0x36, 0x77, 0xea, 0x6d, 0xb3, 0x73, 0x50, 0x3d, 0x38, 0xec, 0x98, - 0xcd, 0xfd, 0xea, 0xf6, 0x41, 0xf3, 0x65, 0x7d, 0x6d, 0xce, 0xb8, 0x8b, 0x6e, 0xcf, 0x84, 0x69, - 0x50, 0xe6, 0xad, 0xa0, 0x17, 0xd5, 0xe6, 0x5e, 0x7d, 0x67, 0x2d, 0x6b, 0xdc, 0x43, 0x1b, 0x33, - 0x41, 0x9d, 0xbd, 0x6a, 0xa7, 0x51, 0xdf, 0x59, 0xcb, 0xd5, 0xf6, 0x7f, 0x7d, 0x53, 0xcc, 0xbc, - 0x7e, 0x53, 0xcc, 0xfc, 0xfd, 0xa6, 0x98, 0x79, 0x75, 0x52, 0x9c, 0x7b, 0x7d, 0x52, 0x9c, 0xfb, - 0xe3, 0xa4, 0x38, 0xf7, 0xcd, 0x39, 0x1e, 0xd1, 0xd1, 0xf4, 0x67, 0x99, 0x7c, 0x51, 0xad, 0x45, - 0xf9, 0x85, 0xf5, 0xec, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x32, 0x71, 0x04, 0x30, 0x0e, - 0x00, 0x00, + // 1241 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcb, 0x6f, 0xdb, 0xc6, + 0x13, 0x36, 0x25, 0x3f, 0xd7, 0x79, 0x38, 0xfc, 0xe5, 0x17, 0xc8, 0x6a, 0xa2, 0x38, 0xca, 0x03, + 0x6e, 0xd0, 0x48, 0x79, 0xf8, 0xd0, 0xab, 0x64, 0xcb, 0x91, 0x52, 0xc3, 0x55, 0x29, 0x3b, 0x40, + 0x7b, 0x21, 0x96, 0xe4, 0x58, 0xda, 0x8a, 0xda, 0x25, 0xc8, 0xa5, 0x2c, 0xdd, 0x0b, 0xf4, 0x9a, + 0x73, 0x81, 0xde, 0x7b, 0x6b, 0xff, 0x8b, 0xf6, 0x52, 0x20, 0x97, 0x02, 0x45, 0x0f, 0x45, 0x11, + 0x1f, 0xfa, 0x5f, 0x14, 0x05, 0x77, 0x97, 0x94, 0x68, 0x53, 0x89, 0x5d, 0x24, 0x17, 0xc3, 0xdc, + 0xf9, 0x66, 0xbe, 0x99, 0x6f, 0x76, 0x66, 0x21, 0x54, 0xb6, 0xb0, 0x35, 0x76, 0x19, 0xad, 0x5a, + 0xdc, 0x0e, 0x38, 0xee, 0x13, 0xda, 0xad, 0x0e, 0x9f, 0x54, 0x61, 0x08, 0x94, 0x07, 0x15, 0xcf, + 0x67, 0x9c, 0xe9, 0xff, 0x57, 0x98, 0xca, 0x04, 0x53, 0x19, 0x3e, 0x29, 0x5e, 0xef, 0xb2, 0x2e, + 0x13, 0x88, 0x6a, 0xf4, 0x9f, 0x04, 0x17, 0xef, 0xd9, 0x2c, 0x18, 0xb0, 0xa0, 0x3a, 0x09, 0x66, + 0x01, 0xc7, 0x4f, 0xe2, 0x6f, 0x85, 0x7a, 0x90, 0x4d, 0x3b, 0x45, 0x20, 0x71, 0xeb, 0x32, 0x9a, + 0x29, 0x69, 0xe4, 0x87, 0x32, 0x5d, 0xc3, 0x03, 0x42, 0x59, 0x55, 0xfc, 0x95, 0x47, 0xe5, 0xef, + 0x72, 0xe8, 0x66, 0x23, 0xca, 0x7c, 0x97, 0x50, 0xec, 0x12, 0x3e, 0x6e, 0xfb, 0x6c, 0x48, 0x1c, + 0xf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0x3b, 0xe0, 0x42, 0x17, 0x73, 0xc2, 0x68, 0x87, 0x63, 0x0e, + 0x87, 0x9e, 0x83, 0x39, 0xe8, 0x0f, 0xd0, 0x55, 0x75, 0xfd, 0x4c, 0x3e, 0x32, 0x7b, 0x38, 0xe8, + 0x49, 0x1d, 0x8c, 0xcb, 0xea, 0xf8, 0x60, 0xd4, 0xc4, 0x41, 0x4f, 0x7f, 0x8e, 0x56, 0x28, 0x1c, + 0x9b, 0x41, 0xe4, 0x2a, 0x44, 0xb8, 0xf2, 0xf4, 0x61, 0x25, 0x73, 0x48, 0x2a, 0x67, 0xb8, 0xc2, + 0xc0, 0x58, 0xa6, 0x70, 0x2c, 0x68, 0xcb, 0x47, 0xe8, 0x86, 0xc8, 0xa8, 0x03, 0x2e, 0xd8, 0x9c, + 0x0c, 0xa1, 0xe3, 0xe2, 0xa0, 0x47, 0x68, 0x57, 0xdf, 0x43, 0xcb, 0x10, 0x75, 0x87, 0xda, 0x20, + 0x72, 0x58, 0x7d, 0xfa, 0x78, 0x06, 0xc3, 0x19, 0xdf, 0x86, 0xf2, 0x33, 0x92, 0x08, 0xe5, 0x6f, + 0x16, 0xd1, 0x75, 0x41, 0xd4, 0x66, 0xc7, 0xe0, 0xef, 0x90, 0x80, 0xab, 0x8a, 0x09, 0x42, 0x41, + 0xe4, 0x06, 0x8e, 0x79, 0xe4, 0x29, 0xa2, 0xe6, 0x0c, 0xa2, 0xac, 0x00, 0xf2, 0xb0, 0x23, 0x43, + 0x9c, 0xbe, 0x58, 0xcd, 0x39, 0x63, 0x45, 0x45, 0xdf, 0xf5, 0xf4, 0x23, 0xb4, 0xf2, 0x35, 0x26, + 0xae, 0x64, 0xca, 0x09, 0xa6, 0xe7, 0x17, 0x66, 0x7a, 0x21, 0x22, 0x64, 0x10, 0x2d, 0xcb, 0xd8, + 0xbb, 0x9e, 0xee, 0xa2, 0xd5, 0x90, 0x4e, 0x98, 0xf2, 0x82, 0xa9, 0x75, 0x61, 0xa6, 0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, + 0xce, 0x6e, 0x6b, 0xbf, 0xb6, 0xd7, 0x3a, 0xf8, 0xd2, 0x6c, 0x1b, 0x9f, 0xbf, 0x6c, 0xed, 0x34, + 0x0c, 0xb3, 0x73, 0x50, 0x3b, 0x38, 0xec, 0x98, 0xad, 0xfd, 0xda, 0xf6, 0x41, 0xeb, 0x65, 0x63, + 0x6d, 0x4e, 0xbf, 0x8b, 0x6e, 0xcf, 0x84, 0x29, 0x90, 0xf6, 0x56, 0xd0, 0x8b, 0x5a, 0x6b, 0xaf, + 0xb1, 0xb3, 0x96, 0xd3, 0xef, 0xa1, 0x8d, 0x99, 0xa0, 0xce, 0x5e, 0xad, 0xd3, 0x6c, 0xec, 0xac, + 0xe5, 0xeb, 0xfb, 0xbf, 0xbc, 0x29, 0x69, 0xaf, 0xdf, 0x94, 0xb4, 0xbf, 0xde, 0x94, 0xb4, 0x57, + 0x27, 0xa5, 0xb9, 0xd7, 0x27, 0xa5, 0xb9, 0xdf, 0x4f, 0x4a, 0x73, 0x5f, 0x9d, 0xe3, 0xbd, 0x1d, + 0x4d, 0xff, 0x82, 0x13, 0x8f, 0xaf, 0xb5, 0x28, 0x7e, 0x8c, 0x3d, 0xfb, 0x37, 0x00, 0x00, 0xff, + 0xff, 0x6e, 0x87, 0xad, 0x9c, 0x5b, 0x0e, 0x00, 0x00, } func (m *EventFinalityProviderCreated) Marshal() (dAtA []byte, err error) { @@ -2045,6 +2054,13 @@ func (m *EventBTCDelgationUnbondedEarly) MarshalToSizedBuffer(dAtA []byte) (int, copy(dAtA[i:], m.NewState) i = encodeVarintEvents(dAtA, i, uint64(len(m.NewState))) i-- + dAtA[i] = 0x1a + } + if len(m.StartHeight) > 0 { + i -= len(m.StartHeight) + copy(dAtA[i:], m.StartHeight) + i = encodeVarintEvents(dAtA, i, uint64(len(m.StartHeight))) + i-- dAtA[i] = 0x12 } if len(m.StakingTxHash) > 0 { @@ -2497,6 +2513,10 @@ func (m *EventBTCDelgationUnbondedEarly) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + l = len(m.StartHeight) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } l = len(m.NewState) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -4715,6 +4735,38 @@ func (m *EventBTCDelgationUnbondedEarly) Unmarshal(dAtA []byte) error { m.StakingTxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartHeight = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NewState", wireType) } diff --git a/x/btcstaking/types/query.go b/x/btcstaking/types/query.go index be17f52d7..db31be424 100644 --- a/x/btcstaking/types/query.go +++ b/x/btcstaking/types/query.go @@ -5,7 +5,7 @@ import ( ) func delegatorUnbondingInfoToResponse(ui *DelegatorUnbondingInfo) *DelegatorUnbondingInfoResponse { - var spendStakeTxHex string = "" + var spendStakeTxHex = "" if len(ui.SpendStakeTx) > 0 { spendStakeTxHex = hex.EncodeToString(ui.SpendStakeTx)