Skip to content

Commit

Permalink
Add IbcTimeout docs
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Apr 28, 2021
1 parent 7b50784 commit 3b116f5
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
6 changes: 4 additions & 2 deletions contracts/ibc-reflect-send/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,10 @@
]
},
"IbcTimeout": {
"description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.",
"anyOf": [
{
"description": "block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain) See https://golang.org/pkg/time/#Time.UnixNano",
"description": "Block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain).",
"type": "object",
"required": [
"timestamp"
Expand All @@ -450,7 +451,7 @@
"additionalProperties": false
},
{
"description": "block after which the packet times out (measured on remote chain)",
"description": "Block after which the packet times out (measured on remote chain).",
"type": "object",
"required": [
"block"
Expand All @@ -463,6 +464,7 @@
"additionalProperties": false
},
{
"description": "Use this to set both timestamp and block timeout. The package then times out once the first of both timeouts is hit.",
"type": "object",
"required": [
"both"
Expand Down
6 changes: 4 additions & 2 deletions contracts/ibc-reflect-send/schema/packet_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,10 @@
]
},
"IbcTimeout": {
"description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.",
"anyOf": [
{
"description": "block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain) See https://golang.org/pkg/time/#Time.UnixNano",
"description": "Block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain).",
"type": "object",
"required": [
"timestamp"
Expand All @@ -403,7 +404,7 @@
"additionalProperties": false
},
{
"description": "block after which the packet times out (measured on remote chain)",
"description": "Block after which the packet times out (measured on remote chain).",
"type": "object",
"required": [
"block"
Expand All @@ -416,6 +417,7 @@
"additionalProperties": false
},
{
"description": "Use this to set both timestamp and block timeout. The package then times out once the first of both timeouts is hit.",
"type": "object",
"required": [
"both"
Expand Down
6 changes: 4 additions & 2 deletions contracts/ibc-reflect/schema/packet_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,10 @@
]
},
"IbcTimeout": {
"description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.",
"anyOf": [
{
"description": "block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain) See https://golang.org/pkg/time/#Time.UnixNano",
"description": "Block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain).",
"type": "object",
"required": [
"timestamp"
Expand All @@ -402,7 +403,7 @@
"additionalProperties": false
},
{
"description": "block after which the packet times out (measured on remote chain)",
"description": "Block after which the packet times out (measured on remote chain).",
"type": "object",
"required": [
"block"
Expand All @@ -415,6 +416,7 @@
"additionalProperties": false
},
{
"description": "Use this to set both timestamp and block timeout. The package then times out once the first of both timeouts is hit.",
"type": "object",
"required": [
"both"
Expand Down
6 changes: 4 additions & 2 deletions contracts/reflect/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,10 @@
]
},
"IbcTimeout": {
"description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.",
"anyOf": [
{
"description": "block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain) See https://golang.org/pkg/time/#Time.UnixNano",
"description": "Block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain).",
"type": "object",
"required": [
"timestamp"
Expand All @@ -446,7 +447,7 @@
"additionalProperties": false
},
{
"description": "block after which the packet times out (measured on remote chain)",
"description": "Block after which the packet times out (measured on remote chain).",
"type": "object",
"required": [
"block"
Expand All @@ -459,6 +460,7 @@
"additionalProperties": false
},
{
"description": "Use this to set both timestamp and block timeout. The package then times out once the first of both timeouts is hit.",
"type": "object",
"required": [
"both"
Expand Down
6 changes: 4 additions & 2 deletions contracts/reflect/schema/response_for__custom_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,10 @@
]
},
"IbcTimeout": {
"description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.",
"anyOf": [
{
"description": "block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain) See https://golang.org/pkg/time/#Time.UnixNano",
"description": "Block timestamp (nanoseconds since UNIX epoch) after which the packet times out (measured on the remote chain).",
"type": "object",
"required": [
"timestamp"
Expand All @@ -434,7 +435,7 @@
"additionalProperties": false
},
{
"description": "block after which the packet times out (measured on remote chain)",
"description": "Block after which the packet times out (measured on remote chain).",
"type": "object",
"required": [
"block"
Expand All @@ -447,6 +448,7 @@
"additionalProperties": false
},
{
"description": "Use this to set both timestamp and block timeout. The package then times out once the first of both timeouts is hit.",
"type": "object",
"required": [
"both"
Expand Down
12 changes: 8 additions & 4 deletions packages/std/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ pub struct IbcEndpoint {
pub channel_id: String,
}

/// In IBC each package must set at least one type of timeout:
/// the timestamp or the block height. Using this rather complex enum instead of
/// two timeout fields we ensure that at least one timeout is set.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum IbcTimeout {
/// block timestamp (nanoseconds since UNIX epoch) after which the packet times out
/// (measured on the remote chain)
/// See https://golang.org/pkg/time/#Time.UnixNano
/// Block timestamp (nanoseconds since UNIX epoch) after which the packet times out
/// (measured on the remote chain).
Timestamp(Timestamp),
/// block after which the packet times out (measured on remote chain)
/// Block after which the packet times out (measured on remote chain).
Block(IbcTimeoutBlock),
/// Use this to set both timestamp and block timeout. The package then times out once
/// the first of both timeouts is hit.
Both {
timestamp: Timestamp,
block: IbcTimeoutBlock,
Expand Down

0 comments on commit 3b116f5

Please sign in to comment.