Skip to content

Commit

Permalink
Unbond recovery (#1704)
Browse files Browse the repository at this point in the history
* proto

* fix broken golang-ci job

* new msgs

* finalise logic for cancel/requeue; add tests

* ensure we zero sendErrors on requeue

* lint fix on main!

* add cli commands for cancel and requeue unbonding actions

* ensure requeued withdrawal records have amount and distribution zeroed as this will be recalculated on processing

* 1705 gov update unbonding status (#1709)

* add proto definitions and generate proto

* add types/msgs.go functions, and tests

* allow gov process to update status of arbitrary unbond

* ensure we nil the completionTime if requeuing (both MsgUpdateRedemption and MsgRequeuRedemption)

---------

Co-authored-by: Jacob Gadikian <[email protected]>
  • Loading branch information
Joe Bowman and faddat authored Aug 10, 2024
1 parent 9af89f5 commit 2201d99
Show file tree
Hide file tree
Showing 20 changed files with 2,682 additions and 484 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
- main
paths-ignore:
- 'web-ui/**'
pull_request:
paths:
- 'icq-relayer/**'

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ mdlint-fix:
### Protobuf ###
###############################################################################

BUF_VERSION=1.31.0
BUF_VERSION=1.35.1

proto-all: proto-gen

Expand Down
149 changes: 128 additions & 21 deletions docs/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1663,10 +1663,7 @@ paths:
protobuf release, and it is not used for type URLs
beginning with
type.googleapis.com. As of May 2023, there are no widely
used type server
implementations and no plans to implement one.
type.googleapis.com.
Schemes other than `http`, `https` (or the empty scheme)
Expand Down Expand Up @@ -1711,10 +1708,6 @@ paths:
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
Example 3: Pack and unpack a message in Python.
Expand Down Expand Up @@ -1754,6 +1747,7 @@ paths:
name "y.z".
JSON
====
Expand Down Expand Up @@ -1980,10 +1974,7 @@ paths:
protobuf release, and it is not used for type URLs
beginning with
type.googleapis.com. As of May 2023, there are no widely
used type server
implementations and no plans to implement one.
type.googleapis.com.
Schemes other than `http`, `https` (or the empty scheme)
Expand Down Expand Up @@ -2028,10 +2019,6 @@ paths:
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
Example 3: Pack and unpack a message in Python.
Expand Down Expand Up @@ -2071,6 +2058,7 @@ paths:
name "y.z".
JSON
====
Expand Down Expand Up @@ -2224,9 +2212,11 @@ paths:
- Msg
/quicksilver/tx/v1/interchainstaking/cancel_redemption:
post:
summary: |-
CancelRedemption defines a method for cancelling a redemption request in
the queued state.
summary: >-
CancelRedemption defines a method for cancelling a redemption request
and
returning the escrowed assets.
operationId: CancelRedemption
responses:
'200':
Expand All @@ -2250,7 +2240,7 @@ paths:
signatures required by gogoproto.
description: >-
MsgRequestRedemptionResponse defines the MsgRequestRedemption
MsgCancelRedemptionResponse defines the MsgCancelRedemption
response type.
default:
description: An unexpected error response.
Expand Down Expand Up @@ -2287,7 +2277,7 @@ paths:
type: string
from_address:
type: string
description: MsgCancelQueuedRedemption represents a message type to cancel .
description: MsgCancelRedemption represents a message type to cancel .
tags:
- Msg
/quicksilver/tx/v1/interchainstaking/close_channel:
Expand Down Expand Up @@ -2577,6 +2567,111 @@ paths:
type: string
tags:
- Msg
/quicksilver/tx/v1/interchainstaking/requeue_redemption:
post:
summary: RequeueRedemption defines a method for requeuing a failed redemption.
operationId: RequeueRedemption
responses:
'200':
description: A successful response.
schema:
type: object
description: >-
MsgRequeueRedemptionResponse defines the MsgRequeueRedemption
response type.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: body
in: body
required: true
schema:
type: object
properties:
chain_id:
type: string
hash:
type: string
from_address:
type: string
description: MsgRequeueRedemption represents a message type to requeue.
tags:
- Msg
/quicksilver/tx/v1/interchainstaking/update_redemption:
post:
summary: UpdateRedemption defines a method for updating a redemption.
operationId: UpdateRedemption
responses:
'200':
description: A successful response.
schema:
type: object
description: >-
MsgUpdateRedemptionResponse defines the MsgUpdateRedemption
response type.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: body
in: body
required: true
schema:
type: object
properties:
chain_id:
type: string
hash:
type: string
new_status:
type: integer
format: int32
from_address:
type: string
description: >-
MsgUpdateRedemption represents a message type to update a
redemption.
tags:
- Msg
/quicksilver/interchainstaking/v1/claimed_percentage/{chain_id}:
get:
summary: >-
Expand Down Expand Up @@ -2964,6 +3059,9 @@ paths:
epoch_number:
type: string
format: int64
send_errors:
type: string
format: int64
pagination:
type: object
properties:
Expand Down Expand Up @@ -3920,6 +4018,9 @@ paths:
epoch_number:
type: string
format: int64
send_errors:
type: string
format: int64
pagination:
type: object
properties:
Expand Down Expand Up @@ -5069,6 +5170,9 @@ paths:
epoch_number:
type: string
format: int64
send_errors:
type: string
format: int64
pagination:
type: object
properties:
Expand Down Expand Up @@ -5267,6 +5371,9 @@ paths:
epoch_number:
type: string
format: int64
send_errors:
type: string
format: int64
pagination:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,15 @@ message WithdrawalRecord {
(gogoproto.nullable) = false
];
string txhash = 7;
int32 status = 8;
int32 status = 8; // should be an enum!
google.protobuf.Timestamp completion_time = 9 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true
];
bool requeued = 10;
bool acknowledged = 11;
int64 epoch_number = 12;
int64 send_errors = 13;
}

message UnbondingRecord {
Expand Down
57 changes: 50 additions & 7 deletions proto/quicksilver/interchainstaking/v1/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,31 @@ service Msg {
};
}

// CancelRedemption defines a method for cancelling a redemption request in
// the queued state.
rpc CancelRedemption(MsgCancelQueuedRedemption) returns (MsgCancelQueuedRedemptionResponse) {
// CancelRedemption defines a method for cancelling a redemption request and
// returning the escrowed assets.
rpc CancelRedemption(MsgCancelRedemption) returns (MsgCancelRedemptionResponse) {
option (google.api.http) = {
post: "/quicksilver/tx/v1/interchainstaking/cancel_redemption"
body: "*"
};
}

// RequeueRedemption defines a method for requeuing a failed redemption.
rpc RequeueRedemption(MsgRequeueRedemption) returns (MsgRequeueRedemptionResponse) {
option (google.api.http) = {
post: "/quicksilver/tx/v1/interchainstaking/requeue_redemption"
body: "*"
};
}

// UpdateRedemption defines a method for updating a redemption.
rpc UpdateRedemption(MsgUpdateRedemption) returns (MsgUpdateRedemptionResponse) {
option (google.api.http) = {
post: "/quicksilver/tx/v1/interchainstaking/update_redemption"
body: "*"
};
}

// SignalIntent defines a method for signalling voting intent for one or more
// validators.
rpc GovCloseChannel(MsgGovCloseChannel) returns (MsgGovCloseChannelResponse) {
Expand Down Expand Up @@ -92,8 +108,8 @@ message MsgRequestRedemption {
// MsgRequestRedemptionResponse defines the MsgRequestRedemption response type.
message MsgRequestRedemptionResponse {}

// MsgCancelQueuedRedemption represents a message type to cancel .
message MsgCancelQueuedRedemption {
// MsgCancelRedemption represents a message type to cancel .
message MsgCancelRedemption {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

Expand All @@ -102,14 +118,41 @@ message MsgCancelQueuedRedemption {
string from_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgRequestRedemptionResponse defines the MsgRequestRedemption response type.
message MsgCancelQueuedRedemptionResponse {
// MsgCancelRedemptionResponse defines the MsgCancelRedemption response type.
message MsgCancelRedemptionResponse {
cosmos.base.v1beta1.Coin returned = 1 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"coin\""
];
}

// MsgUpdateRedemption represents a message type to update a redemption.
message MsgUpdateRedemption {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string chain_id = 1;
string hash = 2;
int32 new_status = 3;
string from_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgUpdateRedemptionResponse defines the MsgUpdateRedemption response type.
message MsgUpdateRedemptionResponse {}

// MsgRequeueRedemption represents a message type to requeue.
message MsgRequeueRedemption {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string chain_id = 1;
string hash = 2;
string from_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgRequeueRedemptionResponse defines the MsgRequeueRedemption response type.
message MsgRequeueRedemptionResponse {}

// MsgSignalIntent represents a message type for signalling voting intent for
// one or more validators.
message MsgSignalIntent {
Expand Down
Loading

0 comments on commit 2201d99

Please sign in to comment.