From 167d97051129ab175dda15752d21fd82f06dd88e Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Thu, 31 Mar 2022 11:09:32 +0200 Subject: [PATCH] updated asset definition on v3.0 transaction types Signed-off-by: Lorenz Herzberger --- .../transaction_chain_migration_election.yaml | 51 +++++++++++++ .../schema/v3.0/transaction_create.yaml | 42 +++++++++++ .../schema/v3.0/transaction_transfer.yaml | 39 ++++++++++ .../v3.0/transaction_validator_election.yaml | 74 +++++++++++++++++++ .../common/schema/v3.0/transaction_vote.yaml | 34 +++++++++ 5 files changed, 240 insertions(+) create mode 100644 planetmint/transactions/common/schema/v3.0/transaction_chain_migration_election.yaml create mode 100644 planetmint/transactions/common/schema/v3.0/transaction_create.yaml create mode 100644 planetmint/transactions/common/schema/v3.0/transaction_transfer.yaml create mode 100644 planetmint/transactions/common/schema/v3.0/transaction_validator_election.yaml create mode 100644 planetmint/transactions/common/schema/v3.0/transaction_vote.yaml diff --git a/planetmint/transactions/common/schema/v3.0/transaction_chain_migration_election.yaml b/planetmint/transactions/common/schema/v3.0/transaction_chain_migration_election.yaml new file mode 100644 index 0000000..932c7b1 --- /dev/null +++ b/planetmint/transactions/common/schema/v3.0/transaction_chain_migration_election.yaml @@ -0,0 +1,51 @@ +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +--- +"$schema": "http://json-schema.org/draft-04/schema#" +type: object +title: Chain Migration Election Schema - Propose a halt in block production to allow for a version change +required: +- operation +- assets +- outputs +properties: + operation: + type: string + value: "CHAIN_MIGRATION_ELECTION" + assets: + type: array + minItems: 1 + maxItems: 1 + items: + "$ref": "#/definitions/asset" + outputs: + type: array + items: + "$ref": "#/definitions/output" +definitions: + asset: + additionalProperties: false + properties: + data: + additionalProperties: false + properties: + seed: + type: string + required: + - data + output: + type: object + properties: + condition: + type: object + required: + - uri + properties: + uri: + type: string + pattern: "^ni:///sha-256;([a-zA-Z0-9_-]{0,86})[?]\ + (fpt=ed25519-sha-256(&)?|cost=[0-9]+(&)?|\ + subtypes=ed25519-sha-256(&)?){2,3}$" diff --git a/planetmint/transactions/common/schema/v3.0/transaction_create.yaml b/planetmint/transactions/common/schema/v3.0/transaction_create.yaml new file mode 100644 index 0000000..3a34a46 --- /dev/null +++ b/planetmint/transactions/common/schema/v3.0/transaction_create.yaml @@ -0,0 +1,42 @@ +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +--- +"$schema": "http://json-schema.org/draft-04/schema#" +type: object +title: Transaction Schema - CREATE specific constraints +required: +- assets +- inputs +properties: + assets: + type: array + minItems: 1 + maxItems: 1 + items: + "$ref": "#/definitions/asset" + inputs: + type: array + title: "Transaction inputs" + maxItems: 1 + minItems: 1 + items: + type: "object" + required: + - fulfills + properties: + fulfills: + type: "null" +definitions: + asset: + additionalProperties: false + properties: + data: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + required: + - data \ No newline at end of file diff --git a/planetmint/transactions/common/schema/v3.0/transaction_transfer.yaml b/planetmint/transactions/common/schema/v3.0/transaction_transfer.yaml new file mode 100644 index 0000000..1bc74e5 --- /dev/null +++ b/planetmint/transactions/common/schema/v3.0/transaction_transfer.yaml @@ -0,0 +1,39 @@ +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +--- +"$schema": "http://json-schema.org/draft-04/schema#" +type: object +title: Transaction Schema - TRANSFER specific properties +required: +- assets +properties: + assets: + type: array + minItems: 1 + items: + "$ref": "#/definitions/asset" + inputs: + type: array + title: "Transaction inputs" + minItems: 1 + items: + type: "object" + required: + - fulfills + properties: + fulfills: + type: "object" +definitions: + sha3_hexdigest: + pattern: "[0-9a-f]{64}" + type: string + asset: + additionalProperties: false + properties: + id: + "$ref": "#/definitions/sha3_hexdigest" + required: + - id diff --git a/planetmint/transactions/common/schema/v3.0/transaction_validator_election.yaml b/planetmint/transactions/common/schema/v3.0/transaction_validator_election.yaml new file mode 100644 index 0000000..0d7c93b --- /dev/null +++ b/planetmint/transactions/common/schema/v3.0/transaction_validator_election.yaml @@ -0,0 +1,74 @@ +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +--- +"$schema": "http://json-schema.org/draft-04/schema#" +type: object +title: Validator Election Schema - Propose a change to validator set +required: +- operation +- assets +- outputs +properties: + operation: + type: string + value: "VALIDATOR_ELECTION" + assets: + type: array + minItems: 1 + maxItems: 1 + items: + "$ref": "#/definitions/asset" + outputs: + type: array + items: + "$ref": "#/definitions/output" +definitions: + output: + type: object + properties: + condition: + type: object + required: + - uri + properties: + uri: + type: string + pattern: "^ni:///sha-256;([a-zA-Z0-9_-]{0,86})[?]\ + (fpt=ed25519-sha-256(&)?|cost=[0-9]+(&)?|\ + subtypes=ed25519-sha-256(&)?){2,3}$" + asset: + additionalProperties: false + properties: + data: + additionalProperties: false + properties: + node_id: + type: string + seed: + type: string + public_key: + type: object + additionalProperties: false + required: + - value + - type + properties: + value: + type: string + type: + type: string + enum: + - ed25519-base16 + - ed25519-base32 + - ed25519-base64 + power: + "$ref": "#/definitions/positiveInteger" + required: + - node_id + - public_key + - power + required: + - data diff --git a/planetmint/transactions/common/schema/v3.0/transaction_vote.yaml b/planetmint/transactions/common/schema/v3.0/transaction_vote.yaml new file mode 100644 index 0000000..64ed6ee --- /dev/null +++ b/planetmint/transactions/common/schema/v3.0/transaction_vote.yaml @@ -0,0 +1,34 @@ +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +--- +"$schema": "http://json-schema.org/draft-04/schema#" +type: object +title: Vote Schema - Vote on an election +required: +- operation +- outputs +properties: + operation: + type: string + value: "VOTE" + outputs: + type: array + items: + "$ref": "#/definitions/output" +definitions: + output: + type: object + properties: + condition: + type: object + required: + - uri + properties: + uri: + type: string + pattern: "^ni:///sha-256;([a-zA-Z0-9_-]{0,86})[?]\ + (fpt=ed25519-sha-256(&)?|cost=[0-9]+(&)?|\ + subtypes=ed25519-sha-256(&)?){2,3}$"