Skip to content

Commit

Permalink
algod:Stateproof server api (#3888)
Browse files Browse the repository at this point in the history
* adding new API to daemon/algod

* stateproof api added

* relocated code inside file

* WIP: unit-tests

* adding range of possible rounds to look for state-proofs.

* stateproof retrival

* fix: import order

* fix: removed comment

* fix: watchdog comments

* restraining the minimum round given to stateproof api

* fix: using latest round as max round to look for the stateproof

* fix name of test

* change in test

* added a possible sort

* fix: import order

Co-authored-by: algoidan <idan@algorand.com>
Co-authored-by: algoidan <79864820+algoidan@users.noreply.github.com>
  • Loading branch information
3 people authored May 2, 2022
1 parent c34780a commit 4009697
Show file tree
Hide file tree
Showing 9 changed files with 780 additions and 356 deletions.
103 changes: 90 additions & 13 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,59 @@
}
]
},
"/v2/transactions/state-proof/{round}": {
"parameters": [
{
"type": "integer",
"name": "round",
"in": "path",
"required": true,
"minimum": 0
}
],
"get": {
"produces": [
"application/json"
],
"schemes": [
"http"
],
"summary": "Get the state proof transaction for a given round",
"operationId": "StateProof",
"responses": {
"200": {
"$ref": "#/components/responses/StateProofResponse"
},
"401": {
"description": "Invalid API Token",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"404": {
"description": "State proof transaction not found",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Internal Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"503": {
"description": "Service Temporarily Unavailable",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"default": {
"description": "Unknown Error"
}
}
}
},
"/v2/applications/{application-id}": {
"get": {
"description": "Given a application ID, it returns application information including creator, approval and clear programs, global and local schemas, and global state.",
Expand Down Expand Up @@ -1295,7 +1348,7 @@
"name": "application-id",
"in": "path",
"required": true
}
}
]
},
"/v2/assets/{asset-id}": {
Expand Down Expand Up @@ -1358,7 +1411,7 @@
"name": "asset-id",
"in": "path",
"required": true
}
}
]
},
"/v2/teal/compile": {
Expand Down Expand Up @@ -1776,8 +1829,8 @@
"properties": {
"amount": {
"description": "\\[a\\] number of units held.",
"type": "integer",
"x-algorand-format": "uint64"
"type": "integer",
"x-algorand-format": "uint64"
},
"asset-id": {
"description": "Asset ID of the holding.",
Expand Down Expand Up @@ -2266,7 +2319,7 @@
"accounts": {
"type": "array",
"items": {
"$ref": "#/definitions/Account"
"$ref": "#/definitions/Account"
}
},
"apps": {
Expand Down Expand Up @@ -2401,7 +2454,7 @@
"asset-index": {
"description": "The asset index if the transaction was found and it created an asset.",
"type": "integer"
},
},
"application-index": {
"description": "The application index if the transaction was found and it created an application.",
"type": "integer"
Expand Down Expand Up @@ -2462,10 +2515,30 @@
},
"txn": {
"description": "The raw signed transaction.",
"type": "object",
"type": "object",
"x-algorand-format": "SignedTransaction"
}
}
},
"StateProof": {
"description": "StateProof transaction.",
"type": "object",
"required": [
"StateProofMessage",
"StateProof"
],
"properties": {
"StateProofMessage": {
"description": "The encoded StateProof message.",
"type": "string",
"format": "byte"
},
"StateProof": {
"description": "The encoded StateProof certificate.",
"type": "string",
"format": "byte"
}
}
}
},
"parameters": {
Expand Down Expand Up @@ -2639,6 +2712,12 @@
}
},
"responses": {
"StateProofResponse": {
"description": "StateProof transaction.",
"schema": {
"$ref": "#/definitions/StateProof"
}
},
"AccountResponse": {
"description": "AccountResponse wraps the Account type in a response.",
"schema": {
Expand Down Expand Up @@ -2679,7 +2758,7 @@
"round": {
"description": "The round for which this information is relevant.",
"type": "integer"
},
},
"app-local-state": {
"description": "\\[appl\\] the application local data stored in this account.\n\nThe raw account uses `AppLocalState` for this type.",
"$ref": "#/definitions/ApplicationLocalState"
Expand Down Expand Up @@ -2772,7 +2851,7 @@
}
}
},
"CatchpointAbortResponse":{
"CatchpointAbortResponse": {
"tags": [
"private"
],
Expand Down Expand Up @@ -2908,12 +2987,12 @@
"$ref": "#/definitions/ParticipationKey"
}
},
"PostParticipationResponse" : {
"PostParticipationResponse": {
"description": "Participation ID of the submission",
"schema": {
"type": "object",
"required": [
"partId"
"partId"
],
"properties": {
"partId": {
Expand All @@ -2922,9 +3001,7 @@
}
}
}

},

"PostTransactionsResponse": {
"description": "Transaction ID of the submission.",
"schema": {
Expand Down
98 changes: 98 additions & 0 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,16 @@
},
"description": "Proof of transaction in a block."
},
"StateProofResponse": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StateProof"
}
}
},
"description": "StateProof transaction."
},
"SupplyResponse": {
"content": {
"application/json": {
Expand Down Expand Up @@ -1542,6 +1552,28 @@
},
"type": "array"
},
"StateProof": {
"description": "StateProof transaction.",
"properties": {
"StateProof": {
"description": "The encoded StateProof certificate.",
"format": "byte",
"pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
"type": "string"
},
"StateProofMessage": {
"description": "The encoded StateProof message.",
"format": "byte",
"pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
"type": "string"
}
},
"required": [
"StateProof",
"StateProofMessage"
],
"type": "object"
},
"TealKeyValue": {
"description": "Represents a key-value pair in an application store.",
"properties": {
Expand Down Expand Up @@ -4197,6 +4229,72 @@
"summary": "Get a specific pending transaction."
}
},
"/v2/transactions/state-proof/{round}": {
"get": {
"operationId": "StateProof",
"parameters": [
{
"in": "path",
"name": "round",
"required": true,
"schema": {
"minimum": 0,
"type": "integer"
}
}
],
"responses": {
"200": {
"$ref": "#/components/responses/StateProofResponse"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Invalid API Token"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "State proof transaction not found"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Error"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Service Temporarily Unavailable"
},
"default": {
"content": {},
"description": "Unknown Error"
}
},
"summary": "Get the state proof transaction for a given round"
}
},
"/versions": {
"get": {
"description": "Retrieves the supported API versions, binary build versions, and genesis information.",
Expand Down
Loading

0 comments on commit 4009697

Please sign in to comment.