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

Merged
merged 11 commits into from
Nov 7, 2024
318 changes: 156 additions & 162 deletions api/starknet_api_openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,141 +907,136 @@
]
},
{
"name": "starknet_getStorageProof",
"summary": "Get merkle paths in one of the state tries: global state, classes, individual contract. A single request can query for any mix of the three types of storage proofs (classes, contracts, and storage).",
"params": [
{
"name": "block_id",
"description": "The hash of the requested block, or number (height) of the requested block, or a block tag",
"required": true,
"schema": {
"title": "Block id",
"$ref": "#/components/schemas/BLOCK_ID"
}
},
{
"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": "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": "starknet_getStorageProof",
"summary": "Get merkle paths in one of the state tries: global state, classes, individual contract. A single request can query for any mix of the three types of storage proofs (classes, contracts, and storage).",
"params": [
{
"name": "block_id",
"description": "The hash of the requested block, or number (height) of the requested block, or a block tag",
"required": true,
"schema": {
"title": "Block id",
"$ref": "#/components/schemas/BLOCK_ID"
}
},
{
"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"
}
],
"result": {
"name": "result",
"description": "The requested storage proofs. Note that if a requested leaf has the default value, the path to it may end in an edge node whose path is not a prefix of the requested leaf, thus effecitvely proving non-membership",
}
},
{
"name": "contract_addresses",
"description": "a list of contracts for which we want to prove membership in the global state trie",
"required": false,
"schema": {
"type": "object",
"properties": {
"classes_proof": {
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
},
"contracts_proof": {
"type": "object",
"properties": {
"nodes": {
"description": "The nodes in the union of the paths from the contracts tree root to the requested leaves",
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
},
"contract_leaves_data": {
"type": "array",
"items": {
"description": "The nonce and class hash for each requested contract address, in the order in which they appear in the request. These values are needed to construct the associated leaf node",
"type": "object",
"properties": {
"nonce": {
"$ref": "#/components/schemas/FELT"
},
"class_hash": {
"$ref": "#/components/schemas/FELT"
}
},
"required": ["nonce", "class_hash"]
}
}
"title": "contracts",
"type": "array",
"items": {
"$ref": "#/components/schemas/ADDRESS"
}
}
},
{
"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"
},
"required": ["nodes", "contract_leaves_data"]
},
"contracts_storage_proofs": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
"storage_keys": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FELT"
}
}
},
"global_roots": {
"type": "object",
"properties": {
"contracts_tree_root": {
"required": ["contract_address", "storage_keys"]
}
}
}
],
"result": {
"name": "result",
"description": "The requested storage proofs. Note that if a requested leaf has the default value, the path to it may end in an edge node whose path is not a prefix of the requested leaf, thus effecitvely proving non-membership",
"schema": {
"type": "object",
"properties": {
"classes_proof": {
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
},
"contracts_proof": {
"type": "object",
"properties": {
"nodes": {
"description": "The nodes in the union of the paths from the contracts tree root to the requested leaves",
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
},
"contract_leaves_data": {
"type": "array",
"items": {
"description": "The nonce and class hash for each requested contract address, in the order in which they appear in the request. These values are needed to construct the associated leaf node",
"type": "object",
"properties": {
"nonce": {
"$ref": "#/components/schemas/FELT"
},
"classes_tree_root": {
},
"class_hash": {
"$ref": "#/components/schemas/FELT"
}
},
"block_hash": {
"description": "the associated block hash (needed in case the caller used a block tag for the block_id parameter)",
"$ref": "#/components/schemas/FELT"
}
},
"required": ["contracts_tree_root", "classes_tree_root", "block_hash"]
}
"required": ["nonce", "class_hash"]
}
}
},
"required": ["nodes", "contract_leaves_data"]
},
"required": [
"classes_proof",
"contracts_proof",
"contracts_storage_proofs",
"global_roots"
]
},
"errors": [
{
"$ref": "#/components/errors/BLOCK_NOT_FOUND"
"contracts_storage_proofs": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
}
},
{
"$ref": "#/components/errors/STORAGE_PROOF_NOT_SUPPORTED"
"global_roots": {
"type": "object",
"properties": {
"contracts_tree_root": {
"$ref": "#/components/schemas/FELT"
},
"classes_tree_root": {
"$ref": "#/components/schemas/FELT"
},
"block_hash": {
"description": "the associated block hash (needed in case the caller used a block tag for the block_id parameter)",
"$ref": "#/components/schemas/FELT"
}
},
"required": ["contracts_tree_root", "classes_tree_root", "block_hash"]
}
]
},
"required": ["classes_proof", "contracts_proof", "contracts_storage_proofs", "global_roots"]
}
}
},
"errors": [
{
"$ref": "#/components/errors/BLOCK_NOT_FOUND"
},
{
"$ref": "#/components/errors/STORAGE_PROOF_NOT_SUPPORTED"
}
]
}
],
"components": {
"contentDescriptors": {},
Expand Down Expand Up @@ -1193,7 +1188,6 @@
"title": "event keys",
"description": "The keys to filter over",
"$ref": "#/components/schemas/EVENT_KEYS"

}
},
"required": []
Expand Down Expand Up @@ -3179,9 +3173,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 @@ -3701,45 +3695,45 @@
"title": "MP node",
"description": "a node in the Merkle-Patricia tree, can be a leaf, binary node, or an edge node",
"oneOf": [
{
"$ref": "#/components/schemas/BINARY_NODE"
},
{
"$ref": "#/components/schemas/EDGE_NODE"
}
{
"$ref": "#/components/schemas/BINARY_NODE"
},
{
"$ref": "#/components/schemas/EDGE_NODE"
}
]
},
"BINARY_NODE": {
"type": "object",
"description": "an internal node whose both children are non-zero",
"properties": {
"left": {
"description": "the hash of the left child",
"$ref": "#/components/schemas/FELT"
},
"right": {
"description": "the hash of the right child",
"$ref": "#/components/schemas/FELT"
}
"left": {
"description": "the hash of the left child",
"$ref": "#/components/schemas/FELT"
},
"right": {
"description": "the hash of the right child",
"$ref": "#/components/schemas/FELT"
}
},
"required": ["left", "right"]
},
"EDGE_NODE": {
"type": "object",
"description": "represents a path to the highest non-zero descendant node",
"properties": {
"path": {
"description": "an integer whose binary representation represents the path from the current node to its highest non-zero descendant (bounded by 2^251)",
"$ref": "#/components/schemas/NUM_AS_HEX"
},
"length": {
"description": "the length of the path (bounded by 251)",
"type": "integer"
},
"child": {
"description": "the hash of the unique non-zero maximal-height descendant node",
"$ref": "#/components/schemas/FELT"
}
"path": {
"description": "an integer whose binary representation represents the path from the current node to its highest non-zero descendant (bounded by 2^251)",
"$ref": "#/components/schemas/NUM_AS_HEX"
},
"length": {
"description": "the length of the path (bounded by 251)",
"type": "integer"
},
"child": {
"description": "the hash of the unique non-zero maximal-height descendant node",
"$ref": "#/components/schemas/FELT"
}
},
"required": ["path", "length", "child"]
},
Expand All @@ -3756,20 +3750,20 @@
"$ref": "#/components/schemas/MERKLE_NODE"
}
},
"required": [
"node_hash",
"node"
]
"required": ["node_hash", "node"]
}
},
"CONTRACT_EXECUTION_ERROR": {
},
"CONTRACT_EXECUTION_ERROR": {
"description": "structured error that can later be processed by wallets or sdks",
"title": "contract execution error",
"$ref": "#/components/schemas/CONTRACT_EXECUTION_ERROR_INNER"
},
"CONTRACT_EXECUTION_ERROR_INNER": {
Comment on lines +3756 to +3761
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is a much neater trick than the previous one! Thanks for finding out how to make this work! 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thing you insisted

"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 Down Expand Up @@ -3878,4 +3872,4 @@
}
}
}
}
}
Loading