From ad2552ec78fbdcae1a5333f0e0378dca59af2e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 15 Feb 2024 12:17:06 +0000 Subject: [PATCH] schema --- .../coconut-dkg/schema/nym-coconut-dkg.json | 310 ++++++++++-------- contracts/coconut-dkg/schema/raw/execute.json | 32 +- contracts/coconut-dkg/schema/raw/query.json | 17 +- .../response_to_get_current_epoch_state.json | 48 ++- .../raw/response_to_get_dealer_details.json | 58 +++- .../raw/response_to_get_dealer_indices.json | 46 +++ 6 files changed, 340 insertions(+), 171 deletions(-) create mode 100644 contracts/coconut-dkg/schema/raw/response_to_get_dealer_indices.json diff --git a/contracts/coconut-dkg/schema/nym-coconut-dkg.json b/contracts/coconut-dkg/schema/nym-coconut-dkg.json index f578fd1bc9..e6fca1f892 100644 --- a/contracts/coconut-dkg/schema/nym-coconut-dkg.json +++ b/contracts/coconut-dkg/schema/nym-coconut-dkg.json @@ -180,15 +180,11 @@ "commit_dealings_chunk": { "type": "object", "required": [ - "chunk", - "resharing" + "chunk" ], "properties": { "chunk": { "$ref": "#/definitions/PartialContractDealing" - }, - "resharing": { - "type": "boolean" } }, "additionalProperties": false @@ -271,6 +267,32 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "trigger_reset" + ], + "properties": { + "trigger_reset": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "trigger_resharing" + ], + "properties": { + "trigger_resharing": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false } ], "definitions": { @@ -365,19 +387,6 @@ }, "additionalProperties": false }, - { - "type": "object", - "required": [ - "get_initial_dealers" - ], - "properties": { - "get_initial_dealers": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, { "type": "object", "required": [ @@ -431,10 +440,10 @@ { "type": "object", "required": [ - "get_past_dealers" + "get_dealer_indices" ], "properties": { - "get_past_dealers": { + "get_dealer_indices": { "type": "object", "properties": { "limit": { @@ -813,15 +822,11 @@ "required": [ "epoch_id", "state", + "state_progress", "time_configuration" ], "properties": { - "epoch_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "finish_timestamp": { + "deadline": { "anyOf": [ { "$ref": "#/definitions/Timestamp" @@ -831,9 +836,17 @@ } ] }, + "epoch_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, "state": { "$ref": "#/definitions/EpochState" }, + "state_progress": { + "$ref": "#/definitions/StateProgress" + }, "time_configuration": { "$ref": "#/definitions/TimeConfiguration" } @@ -956,6 +969,38 @@ } ] }, + "StateProgress": { + "type": "object", + "required": [ + "registered_dealers", + "submitted_dealings", + "submitted_key_shares", + "verified_keys" + ], + "properties": { + "registered_dealers": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "submitted_dealings": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "submitted_key_shares": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "verified_keys": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, "TimeConfiguration": { "type": "object", "required": [ @@ -1154,15 +1199,109 @@ "additionalProperties": false }, "DealerType": { - "type": "string", - "enum": [ - "current", - "past", - "unknown" + "oneOf": [ + { + "type": "string", + "enum": [ + "unknown" + ] + }, + { + "type": "object", + "required": [ + "current" + ], + "properties": { + "current": { + "type": "object", + "required": [ + "assigned_index" + ], + "properties": { + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "past" + ], + "properties": { + "past": { + "type": "object", + "required": [ + "assigned_index" + ], + "properties": { + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } ] } } }, + "get_dealer_indices": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDealerIndexResponse", + "type": "object", + "required": [ + "indices" + ], + "properties": { + "indices": { + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + } + } + }, "get_dealing_chunk": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "DealingChunkResponse", @@ -1455,115 +1594,6 @@ } } }, - "get_initial_dealers": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Nullable_InitialReplacementData", - "anyOf": [ - { - "$ref": "#/definitions/InitialReplacementData" - }, - { - "type": "null" - } - ], - "definitions": { - "Addr": { - "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", - "type": "string" - }, - "InitialReplacementData": { - "type": "object", - "required": [ - "initial_dealers", - "initial_height" - ], - "properties": { - "initial_dealers": { - "type": "array", - "items": { - "$ref": "#/definitions/Addr" - } - }, - "initial_height": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - } - }, - "get_past_dealers": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "PagedDealerResponse", - "type": "object", - "required": [ - "dealers", - "per_page" - ], - "properties": { - "dealers": { - "type": "array", - "items": { - "$ref": "#/definitions/DealerDetails" - } - }, - "per_page": { - "type": "integer", - "format": "uint", - "minimum": 0.0 - }, - "start_next_after": { - "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", - "anyOf": [ - { - "$ref": "#/definitions/Addr" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false, - "definitions": { - "Addr": { - "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", - "type": "string" - }, - "DealerDetails": { - "type": "object", - "required": [ - "address", - "announce_address", - "assigned_index", - "bte_public_key_with_proof", - "ed25519_identity" - ], - "properties": { - "address": { - "$ref": "#/definitions/Addr" - }, - "announce_address": { - "type": "string" - }, - "assigned_index": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "bte_public_key_with_proof": { - "type": "string" - }, - "ed25519_identity": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, "get_state": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "State", diff --git a/contracts/coconut-dkg/schema/raw/execute.json b/contracts/coconut-dkg/schema/raw/execute.json index a576df2219..b1395d8c2e 100644 --- a/contracts/coconut-dkg/schema/raw/execute.json +++ b/contracts/coconut-dkg/schema/raw/execute.json @@ -91,15 +91,11 @@ "commit_dealings_chunk": { "type": "object", "required": [ - "chunk", - "resharing" + "chunk" ], "properties": { "chunk": { "$ref": "#/definitions/PartialContractDealing" - }, - "resharing": { - "type": "boolean" } }, "additionalProperties": false @@ -182,6 +178,32 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "trigger_reset" + ], + "properties": { + "trigger_reset": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "trigger_resharing" + ], + "properties": { + "trigger_resharing": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false } ], "definitions": { diff --git a/contracts/coconut-dkg/schema/raw/query.json b/contracts/coconut-dkg/schema/raw/query.json index 96f50233dd..d55ad0769c 100644 --- a/contracts/coconut-dkg/schema/raw/query.json +++ b/contracts/coconut-dkg/schema/raw/query.json @@ -41,19 +41,6 @@ }, "additionalProperties": false }, - { - "type": "object", - "required": [ - "get_initial_dealers" - ], - "properties": { - "get_initial_dealers": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, { "type": "object", "required": [ @@ -107,10 +94,10 @@ { "type": "object", "required": [ - "get_past_dealers" + "get_dealer_indices" ], "properties": { - "get_past_dealers": { + "get_dealer_indices": { "type": "object", "properties": { "limit": { diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_state.json b/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_state.json index 3f4a9df103..251d4c7e01 100644 --- a/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_state.json +++ b/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_state.json @@ -5,15 +5,11 @@ "required": [ "epoch_id", "state", + "state_progress", "time_configuration" ], "properties": { - "epoch_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "finish_timestamp": { + "deadline": { "anyOf": [ { "$ref": "#/definitions/Timestamp" @@ -23,9 +19,17 @@ } ] }, + "epoch_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, "state": { "$ref": "#/definitions/EpochState" }, + "state_progress": { + "$ref": "#/definitions/StateProgress" + }, "time_configuration": { "$ref": "#/definitions/TimeConfiguration" } @@ -148,6 +152,38 @@ } ] }, + "StateProgress": { + "type": "object", + "required": [ + "registered_dealers", + "submitted_dealings", + "submitted_key_shares", + "verified_keys" + ], + "properties": { + "registered_dealers": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "submitted_dealings": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "submitted_key_shares": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "verified_keys": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, "TimeConfiguration": { "type": "object", "required": [ diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json b/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json index 776cfefbc1..0590e2802f 100644 --- a/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json +++ b/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json @@ -57,11 +57,59 @@ "additionalProperties": false }, "DealerType": { - "type": "string", - "enum": [ - "current", - "past", - "unknown" + "oneOf": [ + { + "type": "string", + "enum": [ + "unknown" + ] + }, + { + "type": "object", + "required": [ + "current" + ], + "properties": { + "current": { + "type": "object", + "required": [ + "assigned_index" + ], + "properties": { + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "past" + ], + "properties": { + "past": { + "type": "object", + "required": [ + "assigned_index" + ], + "properties": { + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } ] } } diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_dealer_indices.json b/contracts/coconut-dkg/schema/raw/response_to_get_dealer_indices.json new file mode 100644 index 0000000000..2d8e0c8763 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/response_to_get_dealer_indices.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDealerIndexResponse", + "type": "object", + "required": [ + "indices" + ], + "properties": { + "indices": { + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + } + } +}