Skip to content

Commit

Permalink
Merge pull request #118 from starkware-libs/fix_declarev2_and_add_errors
Browse files Browse the repository at this point in the history
bugs fixes: add tx_hash, errors, and compiled_class_hash (#118)
  • Loading branch information
ArielElp authored Jul 26, 2023
2 parents 2e19ab7 + 1459da6 commit c774349
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 46 deletions.
113 changes: 78 additions & 35 deletions api/starknet_api_openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,23 @@
"name": "result",
"schema": {
"title": "Transaction",
"$ref": "#/components/schemas/TXN"
"allOf": [
{
"$ref": "#/components/schemas/TXN"
},
{
"type": "object",
"properties": {
"transaction_hash": {
"title": "transaction hash",
"$ref": "#/components/schemas/TXN_HASH"
}
},
"required": [
"transaction_hash"
]
}
]
}
},
"errors": [
Expand Down Expand Up @@ -227,7 +243,23 @@
"name": "transactionResult",
"schema": {
"title": "Transaction",
"$ref": "#/components/schemas/TXN"
"allOf": [
{
"$ref": "#/components/schemas/TXN"
},
{
"type": "object",
"properties": {
"transaction_hash": {
"title": "transaction hash",
"$ref": "#/components/schemas/TXN_HASH"
}
},
"required": [
"transaction_hash"
]
}
]
}
},
"errors": [
Expand Down Expand Up @@ -664,7 +696,23 @@
"type": "array",
"title": "Pending Transactions",
"items": {
"$ref": "#/components/schemas/TXN"
"allOf": [
{
"$ref": "#/components/schemas/TXN"
},
{
"type": "object",
"properties": {
"transaction_hash": {
"title": "transaction hash",
"$ref": "#/components/schemas/TXN_HASH"
}
},
"required": [
"transaction_hash"
]
}
]
}
}
}
Expand Down Expand Up @@ -1644,6 +1692,11 @@
"description": "The address of the account contract sending the declaration transaction",
"$ref": "#/components/schemas/ADDRESS"
},
"compiled_class_hash": {
"title": "Compiled class hash",
"description": "The hash of the Cairo assembly resulting from the Sierra compilation",
"$ref": "#/components/schemas/FELT"
},
"max_fee": {
"title": "Max fee",
"$ref": "#/components/schemas/FELT",
Expand All @@ -1666,6 +1719,7 @@
"required": [
"type",
"sender_address",
"compiled_class_hash",
"max_fee",
"version",
"signature",
Expand Down Expand Up @@ -1814,6 +1868,13 @@
"title": "Invoke transaction V0",
"description": "invokes a specific function in the desired contract (not necessarily an account)",
"properties": {
"type": {
"title": "Type",
"type": "string",
"enum": [
"INVOKE"
]
},
"max_fee": {
"title": "Max fee",
"$ref": "#/components/schemas/FELT",
Expand Down Expand Up @@ -1846,6 +1907,7 @@
}
},
"required": [
"type",
"contract_address",
"entry_point_selector",
"calldata",
Expand All @@ -1861,6 +1923,13 @@
{
"type": "object",
"properties": {
"type": {
"title": "Type",
"type": "string",
"enum": [
"INVOKE"
]
},
"sender_address": {
"title": "sender address",
"$ref": "#/components/schemas/ADDRESS"
Expand Down Expand Up @@ -1893,6 +1962,7 @@
}
},
"required": [
"type",
"sender_address",
"calldata",
"max_fee",
Expand All @@ -1906,35 +1976,14 @@
"INVOKE_TXN": {
"title": "Invoke transaction",
"description": "Initiate a transaction from an account",
"allOf": [
"oneOf": [
{
"type": "object",
"title": "Type",
"properties": {
"type": {
"title": "Type",
"type": "string",
"enum": [
"INVOKE"
]
}
},
"required": [
"type"
]
"title": "Invoke transaction V0",
"$ref": "#/components/schemas/INVOKE_TXN_V0"
},
{
"title": "Invoke transaction properties",
"oneOf": [
{
"title": "Invoke transaction V0",
"$ref": "#/components/schemas/INVOKE_TXN_V0"
},
{
"title": "Invoke transaction V1",
"$ref": "#/components/schemas/INVOKE_TXN_V1"
}
]
"title": "Invoke transaction V1",
"$ref": "#/components/schemas/INVOKE_TXN_V1"
}
]
},
Expand All @@ -1946,11 +1995,6 @@
"title": "L1 handler transaction",
"description": "a call to an l1_handler on an L2 contract induced by a message from L1",
"properties": {
"transaction_hash": {
"title": "Transaction hash",
"$ref": "#/components/schemas/TXN_HASH",
"description": "The hash identifying the transaction"
},
"version": {
"title": "Version",
"description": "Version of the transaction scheme",
Expand All @@ -1970,7 +2014,6 @@
}
},
"required": [
"transaction_hash",
"version",
"type",
"nonce"
Expand Down
89 changes: 78 additions & 11 deletions api/starknet_write_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"description": "The information needed to invoke the function (or account, for version 1 transactions)",
"required": true,
"schema": {
"$ref": "#/components/schemas/INVOKE_TXN"
"$ref": "#/components/schemas/INVOKE_TXN_V1"
}
}
],
Expand All @@ -33,7 +33,29 @@
}
}
},
"errors": []
"errors": [
{
"$ref": "#/components/errors/INSUFFICIENT_ACCOUNT_BALANCE"
},
{
"$ref": "#/components/errors/INSUFFICIENT_MAX_FEE"
},
{
"$ref": "#/components/errors/INVALID_TRANSACTION_NONCE"
},
{
"$ref": "#/components/errors/VALIDATION_FAILURE"
},
{
"$ref": "#/components/errors/NON_ACCOUNT"
},
{
"$ref": "#/components/errors/CLASS_HASH_NOT_FOUND"
},
{
"$ref": "#/components/errors/DUPLICATE_TX"
}
]
},
{
"name": "starknet_addDeclareTransaction",
Expand Down Expand Up @@ -68,10 +90,37 @@
},
"errors": [
{
"$ref": "#/components/errors/INVALID_CONTRACT_CLASS"
"$ref": "#/components/errors/CLASS_ALREADY_DECLARED"
},
{
"$ref": "#/components/errors/CLASS_ALREADY_DECLARED"
"$ref": "#/components/errors/COMPILATION_FAILED"
},
{
"$ref": "#/components/errors/COMPILED_CLASS_HASH_MISMATCH"
},
{
"$ref": "#/components/errors/INSUFFICIENT_ACCOUNT_BALANCE"
},
{
"$ref": "#/components/errors/INSUFFICIENT_MAX_FEE"
},
{
"$ref": "#/components/errors/INVALID_TRANSACTION_NONCE"
},
{
"$ref": "#/components/errors/VALIDATION_FAILURE"
},
{
"$ref": "#/components/errors/NON_ACCOUNT"
},
{
"$ref": "#/components/errors/CLASS_HASH_NOT_FOUND"
},
{
"$ref": "#/components/errors/DUPLICATE_TX"
},
{
"$ref": "#/components/errors/CONTRACT_BYTECODE_SIZE_IS_TOO_LARGE"
}
]
},
Expand Down Expand Up @@ -106,8 +155,26 @@
}
},
"errors": [
{
"$ref": "#/components/errors/INSUFFICIENT_ACCOUNT_BALANCE"
},
{
"$ref": "#/components/errors/INSUFFICIENT_MAX_FEE"
},
{
"$ref": "#/components/errors/INVALID_TRANSACTION_NONCE"
},
{
"$ref": "#/components/errors/VALIDATION_FAILURE"
},
{
"$ref": "#/components/errors/NON_ACCOUNT"
},
{
"$ref": "#/components/errors/CLASS_HASH_NOT_FOUND"
},
{
"$ref": "#/components/errors/DUPLICATE_TX"
}
]
}
Expand All @@ -129,8 +196,8 @@
"TXN_HASH": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_HASH"
},
"INVOKE_TXN": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/INVOKE_TXN"
"INVOKE_TXN_V1": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/INVOKE_TXN_V1"
},
"DECLARE_TXN": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/DECLARE_TXN"
Expand All @@ -143,10 +210,6 @@
}
},
"errors": {
"INVALID_CONTRACT_CLASS": {
"code": 50,
"message": "Invalid contract class"
},
"CLASS_HASH_NOT_FOUND": {
"code": 28,
"message": "Class hash not found"
Expand Down Expand Up @@ -175,7 +238,7 @@
"code": 56,
"message": "Compilation failed"
},
"CONTRACT_BYTECODE_SIZE_TOO_LARGE": {
"CONTRACT_BYTECODE_SIZE_IS_TOO_LARGE": {
"code": 57,
"message": "Contract bytecode size it too large"
},
Expand All @@ -186,6 +249,10 @@
"DUPLICATE_TX": {
"code": 59,
"message": "A transaction with the same hash already exists in the mempool"
},
"COMPILED_CLASS_HASH_MISMATCH": {
"code": 60,
"message": "the compiled class hash did not match the one supplied in the transaction"
}
}
}
Expand Down

0 comments on commit c774349

Please sign in to comment.