Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: blocks/{round}/logs endpoint #5865

Merged
merged 30 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0a2c6c9
GetBlockLogs
joe-p Oct 30, 2023
fab4471
fix duplicate semaphore import
joe-p Dec 10, 2023
efbcbb8
add oapi path
joe-p Dec 10, 2023
133934a
use sized slice for byte logs
joe-p Dec 11, 2023
9de4a6b
NewBlockLog
joe-p Dec 11, 2023
ec9c4b8
remove array references
joe-p Dec 11, 2023
c719af7
check length of logs before NewBlockLog
joe-p Dec 11, 2023
23a3257
getAppIndexFromTxn
joe-p Dec 11, 2023
1d6c94c
add tests
joe-p Jan 19, 2024
916cf79
fix typo
joe-p Jan 19, 2024
6a41466
use convertSlice
joe-p Jan 19, 2024
bc94490
fix convertSlice
joe-p Jan 19, 2024
4909d96
return BlockLog value from NewBlockLog
joe-p Jan 19, 2024
8c3ae7e
BlockLog -> AppCallLogs
joe-p Jan 19, 2024
2e47646
test with inner txn log
joe-p Feb 1, 2024
6363c29
add missing assignment, calc txid once
joe-p Feb 1, 2024
4483a90
test multiple outer app calls in block
joe-p Feb 1, 2024
b9e4f3b
missing a.NoError
joe-p Feb 1, 2024
8dd11ba
NewBlockLog -> NewAppCallLogs (with comment)
joe-p Feb 23, 2024
0526996
assert equality for fully formed response struct
joe-p Feb 23, 2024
b3add97
fix asserts
joe-p Feb 23, 2024
a504839
use append name/arg order
joe-p Apr 25, 2024
72aedc5
update comment
joe-p Apr 25, 2024
94fc1f0
txid -> txId
joe-p Apr 25, 2024
6209b64
single call to appendLogsFromTxns for each outer txn
joe-p Apr 25, 2024
9366062
don't append inners to outer in appendLogsFromTxns call
joe-p Apr 25, 2024
733567f
more test scenarios
joe-p Apr 25, 2024
340ad0a
update descriptions
joe-p Apr 25, 2024
ac5748c
Merge branch 'master' into feat/blocks_log_endpoint
joe-p Apr 29, 2024
267de9e
update descriptions to specify order
joe-p Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,62 @@
}
]
},
"/v2/blocks/{round}/logs": {
"get": {
"tags": [
"public",
"nonparticipating"
],
"description": "Get all of the logs from outer and inner app calls in the given round",
"produces": [
"application/json"
],
"schemes": [
"http"
],
"summary": "Get all of the logs from outer and inner app calls in the given round",
"operationId": "GetBlockLogs",
"parameters": [
{
"minimum": 0,
"type": "integer",
"description": "The round from which to fetch block log information.",
"name": "round",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/BlockLogsResponse"
},
"400": {
"description": "Bad Request - Non integer number",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"401": {
"description": "Invalid API Token",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"404": {
"description": "Nonexistent block ",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Internal Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/v2/ledger/supply": {
"get": {
"tags": [
Expand Down Expand Up @@ -4449,6 +4505,33 @@
}
}
}
},
"AppCallLogs": {
jannotti marked this conversation as resolved.
Show resolved Hide resolved
"description": "An array of logs for a given application ID and outer transaction ID",
"type": "object",
"required": [
"logs",
"application-index",
"txid"
joe-p marked this conversation as resolved.
Show resolved Hide resolved
],
"properties": {
"logs": {
"description": "An array of logs",
"type": "array",
"items": {
"type": "string",
"format": "byte"
}
},
"application-index": {
"description": "The application from which the logs were generated",
"type": "integer"
},
"txid": {
"description": "The transaction ID of the outer app call that lead to these logs",
"type": "string"
}
}
}
},
"parameters": {
Expand Down Expand Up @@ -5106,6 +5189,23 @@
}
}
},
"BlockLogsResponse": {
"description": "All of the logs from outer and inner app calls in the given round",
"schema": {
"type": "object",
"required": [
"logs"
],
"properties": {
"logs": {
"type": "array",
"items": {
"$ref": "#/definitions/AppCallLogs"
}
}
}
}
},
"SupplyResponse": {
"description": "Supply represents the current supply of MicroAlgos in the system.",
"schema": {
Expand Down
135 changes: 135 additions & 0 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,27 @@
},
"description": "Hash of a block header."
},
"BlockLogsResponse": {
"content": {
"application/json": {
"schema": {
"properties": {
"logs": {
"items": {
"$ref": "#/components/schemas/AppCallLogs"
},
"type": "array"
}
},
"required": [
"logs"
],
"type": "object"
}
}
},
"description": "All of the logs from outer and inner app calls in the given round"
},
"BlockResponse": {
"content": {
"application/json": {
Expand Down Expand Up @@ -1203,6 +1224,34 @@
],
"type": "object"
},
"AppCallLogs": {
"description": "An array of logs for a given application ID and outer transaction ID",
"properties": {
"application-index": {
"description": "The application from which the logs were generated",
"type": "integer"
},
"logs": {
"description": "An array of logs",
"items": {
"format": "byte",
"pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
"type": "string"
},
"type": "array"
},
"txid": {
"description": "The transaction ID of the outer app call that lead to these logs",
"type": "string"
}
},
"required": [
"application-index",
"logs",
"txid"
],
"type": "object"
},
"Application": {
"description": "Application index and its parameters",
"properties": {
Expand Down Expand Up @@ -3976,6 +4025,92 @@
]
}
},
"/v2/blocks/{round}/logs": {
"get": {
"description": "Get all of the logs from outer and inner app calls in the given round",
"operationId": "GetBlockLogs",
"parameters": [
{
"description": "The round from which to fetch block log information.",
"in": "path",
"name": "round",
"required": true,
"schema": {
"minimum": 0,
"type": "integer"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"logs": {
"items": {
"$ref": "#/components/schemas/AppCallLogs"
},
"type": "array"
}
},
"required": [
"logs"
],
"type": "object"
}
}
},
"description": "All of the logs from outer and inner app calls in the given round"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Bad Request - Non integer number"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Invalid API Token"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Nonexistent block "
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Error"
}
},
"summary": "Get all of the logs from outer and inner app calls in the given round",
"tags": [
"public",
"nonparticipating"
]
}
},
"/v2/blocks/{round}/transactions/{txid}/proof": {
"get": {
"operationId": "GetTransactionProof",
Expand Down
6 changes: 6 additions & 0 deletions daemon/algod/api/client/restClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,3 +776,9 @@ func (client RestClient) GetBlockTimestampOffset() (response model.GetBlockTimeS
err = client.get(&response, "/v2/devmode/blocks/offset", nil)
return
}

// BlockLogs returns all the logs in a block for a given round
func (client RestClient) BlockLogs(round uint64) (response model.BlockLogsResponse, err error) {
err = client.get(&response, fmt.Sprintf("/v2/blocks/%d/logs", round), nil)
return
}
Loading
Loading