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

Fix validation script after adding structured errors #235

Open
wants to merge 5 commits into
base: v0.8.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
264 changes: 127 additions & 137 deletions api/starknet_api_openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,50 +249,50 @@
]
},
{
"name": "starknet_getMessagesStatus",
"summary": "Given an l1 tx hash, returns the associated l1_handler tx hashes and statuses for all L1 -> L2 messages sent by the l1 ransaction, ordered by the l1 tx sending order",
"paramStructure": "by-name",
"params": [
{
"name": "transaction_hash",
"summary": "The hash of the L1 transaction that sent L1->L2 messages",
"required": true,
"schema": {
"title": "Transaction hash",
"$ref": "#/components/schemas/L1_TXN_HASH"
}
}
],
"result": {
"name": "result",
"schema": {
"type": "array",
"items": {
"type": "object",
"title": "status",
"properties": {
"transaction_hash": {
"$ref": "#/components/schemas/TXN_HASH"
},
"finality_status": {
"title": "finality status",
"$ref": "#/components/schemas/TXN_STATUS"
},
"failure_reason": {
"title": "failure reason",
"description": "the failure reason, only appears if finality_status is REJECTED",
"type": "string"
}
},
"required": ["transaction_hash", "finality_status"]
}
}
},
"errors": [
{
"$ref": "#/components/errors/TXN_HASH_NOT_FOUND"
}
]
"name": "starknet_getMessagesStatus",
"summary": "Given an l1 tx hash, returns the associated l1_handler tx hashes and statuses for all L1 -> L2 messages sent by the l1 ransaction, ordered by the l1 tx sending order",
"paramStructure": "by-name",
"params": [
{
"name": "transaction_hash",
"summary": "The hash of the L1 transaction that sent L1->L2 messages",
"required": true,
"schema": {
"title": "Transaction hash",
"$ref": "#/components/schemas/L1_TXN_HASH"
}
}
],
"result": {
"name": "result",
"schema": {
"type": "array",
"items": {
"type": "object",
"title": "status",
"properties": {
"transaction_hash": {
"$ref": "#/components/schemas/TXN_HASH"
},
"finality_status": {
"title": "finality status",
"$ref": "#/components/schemas/TXN_STATUS"
},
"failure_reason": {
"title": "failure reason",
"description": "the failure reason, only appears if finality_status is REJECTED",
"type": "string"
}
},
"required": ["transaction_hash", "finality_status"]
}
}
},
"errors": [
{
"$ref": "#/components/errors/TXN_HASH_NOT_FOUND"
}
]
},
{
"name": "starknet_getTransactionByHash",
Expand Down Expand Up @@ -907,84 +907,80 @@
]
},
{
"name": "starknet_getStorageProof",
"summary": "get merkle paths in one of the state tries: global state, classes, individual contract",
"params": [
{
"name": "class_hashes",
"description": "a list of the class hashes for which we want to prove membership in the classes trie",
"required": false,
"schema": {
"title": "classes",
"type": "array",
"items": {
"$ref": "#/components/schemas/FELT"
}
}
},
{
"name": "contract_addresses",
"description": "a list of contracts for which we want to prove membership in the global state trie",
"required": false,
"schema": {
"title": "contracts",
"type": "array",
"items": {
"$ref": "#/components/schemas/ADDRESS"
}
"name": "starknet_getStorageProof",
"summary": "get merkle paths in one of the state tries: global state, classes, individual contract",
"params": [
{
"name": "class_hashes",
"description": "a list of the class hashes for which we want to prove membership in the classes trie",
"required": false,
"schema": {
"title": "classes",
"type": "array",
"items": {
"$ref": "#/components/schemas/FELT"
}
},
{
"name": "contracts_storage_keys",
"description": "a list of (contract_address, storage_keys) pairs",
"required": false,
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"contract_address": {
"$ref": "#/components/schemas/ADDRESS"
},
"storage_keys": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FELT"
}
}
},
"required": ["contract_address", "storage_keys"]
}
}
},
{
"name": "contract_addresses",
"description": "a list of contracts for which we want to prove membership in the global state trie",
"required": false,
"schema": {
"title": "contracts",
"type": "array",
"items": {
"$ref": "#/components/schemas/ADDRESS"
}
}
],
"result": {
"name": "result",
"description": "The contract's nonce at the requested state",
},
{
"name": "contracts_storage_keys",
"description": "a list of (contract_address, storage_keys) pairs",
"required": false,
"schema": {
"type": "object",
"properties": {
"classes_proof": {
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
"type": "array",
"items": {
"type": "object",
"properties": {
"contract_address": {
"$ref": "#/components/schemas/ADDRESS"
},
"storage_keys": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FELT"
}
}
},
"contracts_proof": {
"required": ["contract_address", "storage_keys"]
}
}
}
],
"result": {
"name": "result",
"description": "The contract's nonce at the requested state",
"schema": {
"type": "object",
"properties": {
"classes_proof": {
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
},
"contracts_proof": {
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
},
"contracts_storage_proofs": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
},
"contracts_storage_proofs": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
}
}
},
"required": [
"classes_proof",
"contracts_proof",
"contracts_storage_proofs"
]
}
}
},
"required": ["classes_proof", "contracts_proof", "contracts_storage_proofs"]
}
}
}
],
"components": {
"contentDescriptors": {},
Expand Down Expand Up @@ -1136,7 +1132,6 @@
"title": "event keys",
"description": "The keys to filter over",
"$ref": "#/components/schemas/EVENT_KEYS"

}
},
"required": []
Expand Down Expand Up @@ -3115,9 +3110,9 @@
"$ref": "#/components/schemas/TXN_EXECUTION_STATUS"
},
"failure_reason": {
"title": "failure reason",
"description": "the failure reason, only appears if finality_status is REJECTED or execution_status is REVERTED",
"type": "string"
"title": "failure reason",
"description": "the failure reason, only appears if finality_status is REJECTED or execution_status is REVERTED",
"type": "string"
}
},
"required": ["finality_status"]
Expand Down Expand Up @@ -3656,17 +3651,10 @@
"$ref": "#/components/schemas/FELT"
}
},
"required": [
"left",
"right"
]
"required": ["left", "right"]
}
},
"required": [
"path",
"length",
"value"
]
"required": ["path", "length", "value"]
},
"NODE_HASH_TO_NODE_MAPPING": {
"description": "a node_hash -> node mapping of all the nodes in the union of the paths between the requested leaves and the root (for each node present, its sibling is also present)",
Expand All @@ -3681,20 +3669,18 @@
"$ref": "#/components/schemas/MERKLE_NODE"
}
},
"required": [
"node_hash",
"node"
]
"required": ["node_hash", "node"]
}
},
"CONTRACT_EXECUTION_ERROR": {
},
"CONTRACT_EXECUTION_ERROR": {
"$ref": "#/components/schemas/CONTRACT_EXECUTION_ERROR_INNER"
},
"CONTRACT_EXECUTION_ERROR_INNER": {
"description": "structured error that can later be processed by wallets or sdks",
"title": "contract execution error",
"oneOf": [
{
"type": "object",
"title": "inner call",
"description": "error frame",
"properties": {
"contract_address": {
"$ref": "#/components/schemas/ADDRESS"
Expand All @@ -3705,11 +3691,15 @@
"selector": {
"$ref": "#/components/schemas/FELT"
},
"error": {
"$ref": "#/components/schemas/CONTRACT_EXECUTION_ERROR"
"errors": {
"title": "Nested Errors",
"type": "array",
"items": {
"$ref": "#/components/schemas/CONTRACT_EXECUTION_ERROR"
}
}
},
"required": ["contract_address", "class_hash", "selector", "error"]
"required": ["contract_address", "class_hash", "selector", "errors"]
},
{
"title": "error message",
Expand Down
17 changes: 4 additions & 13 deletions api/starknet_trace_api_openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"errors": [
{
"$ref": "#/components/errors/TXN_HASH_NOT_FOUND"
"$ref": "./api/starknet_api_openrpc.json#/components/errors/TXN_HASH_NOT_FOUND"
},
{
"$ref": "#/components/errors/NO_TRACE_AVAILABLE"
Expand Down Expand Up @@ -97,10 +97,10 @@
},
"errors": [
{
"$ref": "#/components/errors/BLOCK_NOT_FOUND"
"$ref": "./api/starknet_api_openrpc.json#/components/errors/BLOCK_NOT_FOUND"
},
{
"$ref": "#/components/errors/TRANSACTION_EXECUTION_ERROR"
"$ref": "./api/starknet_api_openrpc.json#/components/errors/TRANSACTION_EXECUTION_ERROR"
}
]
},
Expand Down Expand Up @@ -139,7 +139,7 @@
},
"errors": [
{
"$ref": "#/components/errors/BLOCK_NOT_FOUND"
"$ref": "./api/starknet_api_openrpc.json#/components/errors/BLOCK_NOT_FOUND"
}
]
}
Expand Down Expand Up @@ -480,15 +480,6 @@
}
}
}
},
"TXN_HASH_NOT_FOUND": {
"$ref": "./api/starknet_api_openrpc.json#/components/errors/TXN_HASH_NOT_FOUND"
},
"BLOCK_NOT_FOUND": {
"$ref": "./api/starknet_api_openrpc.json#/components/errors/BLOCK_NOT_FOUND"
},
"TRANSACTION_EXECUTION_ERROR": {
"$ref": "./api/starknet_api_openrpc.json#/components/errors/TRANSACTION_EXECUTION_ERROR"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function fixRefs(dereffer) {
async function derefAll(doc) {
let allSchemas = doc.components.schemas;
let refCacheWithRecursiveRef = {
"#/components/schemas/CONTRACT_EXECUTION_ERROR": allSchemas["CONTRACT_EXECUTION_ERROR"],
"#/components/schemas/NESTED_CALL": allSchemas["NESTED_CALL"],
};
let dereferencerOptions = {
Expand Down