From 0ad1d8e585dd27e672bf9faf2f3fac04111613d8 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Fri, 1 Sep 2023 21:08:33 -0700 Subject: [PATCH 1/7] introduce v3 transaction and add missing fields --- api/starknet_api_openrpc.json | 719 ++++++++++++++++++++++++++++++++-- 1 file changed, 676 insertions(+), 43 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index f98884e..665c7da 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -289,8 +289,16 @@ "result": { "name": "result", "schema": { - "title": "Transaction receipt", - "$ref": "#/components/schemas/TXN_RECEIPT" + "oneOf": [ + { + "title": "Transaction receipt", + "$ref": "#/components/schemas/TXN_RECEIPT" + }, + { + "title": "Pending transaction receipt", + "$ref": "#/components/schemas/PENDING_TXN_RECEIPT" + } + ] } }, "errors": [ @@ -1357,6 +1365,16 @@ "title": "Sequencer address", "description": "The StarkNet identity of the sequencer submitting this block", "$ref": "#/components/schemas/FELT" + }, + "l1_gas_price": { + "title": "L1 gas price", + "descritpion": "The price of l1 gas in the block", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "starknet_version": { + "title": "Starknet version", + "description": "Semver of the current Starknet protocol", + "type": "string" } }, "required": [ @@ -1592,6 +1610,10 @@ { "title": "Declare transaction V2", "$ref": "#/components/schemas/DECLARE_TXN_V2" + }, + { + "title": "Declare transaction V3", + "$ref": "#/components/schemas/DECLARE_TXN_V3" } ] }, @@ -1773,6 +1795,107 @@ } ] }, + "DECLARE_TXN_V3": { + "title": "Declare Transaction V2", + "description": "Declare Contract Transaction V2", + "allOf": [ + { + "type": "object", + "title": "Declare txn v2", + "properties": { + "type": { + "title": "Declare", + "type": "string", + "enum": [ + "DECLARE" + ] + }, + "sender_address": { + "title": "Sender address", + "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", + "description": "The maximal fee that can be charged for including the transaction" + }, + "version": { + "title": "Version", + "description": "Version of the transaction scheme", + "type": "string", + "enum": [ + "0x2" + ] + }, + "signature": { + "title": "Signature", + "$ref": "#/components/schemas/SIGNATURE" + }, + "nonce": { + "title": "Nonce", + "$ref": "#/components/schemas/FELT" + }, + "class_hash": { + "title": "Class hash", + "description": "The hash of the declared class", + "$ref": "#/components/schemas/FELT" + }, + "l1_gas": { + "title": "L1 Gas", + "description": "The max amount and max price per unit of L1 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + }, + "l2_gas": { + "title": "L2 Gas", + "description": "The max amount and max price per unit of L2 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + }, + "tip": { + "title": "Tip", + "$ref": "#/components/schemas/FELT", + "description": "the tip for the transaction" + }, + "paymaster_address": { + "title": "Paymaster", + "$ref": "#/components/schemas/ADDRESS", + "description": "the address of the paymaster that pays for the tx in native tokens, 0 if no paymaster is used" + }, + "nonce_data_availability_mode": { + "title": "Nonce DA mode", + "description": "The storage domain of the account's nonce (an account has a nonce per DA mode)", + "$ref": "#/components/schemas/DA_MODE" + }, + "fee_data_availability_mode": { + "title": "Fee DA mode", + "description": "The storage domain of the account's balance from which fee will be charged", + "$ref": "#/components/schemas/DA_MODE" + } + }, + "required": [ + "type", + "sender_address", + "compiled_class_hash", + "max_fee", + "version", + "signature", + "nonce", + "class_hash", + "l1_gas", + "l2_gas", + "tip", + "paymaster_address", + "nonce_data_availability_mode", + "fee_data_availability_mode" + ] + } + ] + }, "BROADCASTED_TXN": { "oneOf": [ { @@ -1788,7 +1911,16 @@ }, "BROADCASTED_INVOKE_TXN": { "title": "Broadcasted invoke transaction", - "$ref": "#/components/schemas/INVOKE_TXN_V1" + "oneOf": [ + { + "title": "Broadcasted invoke transaction V1", + "$ref": "#/components/schemas/INVOKE_TXN_V1" + }, + { + "title": "Broadcasted invoke transaction V2", + "$ref": "#/components/schemas/INVOKE_TXN_V3" + } + ] }, "BROADCASTED_DEPLOY_ACCOUNT_TXN": { "title": "Broadcasted deploy account transaction", @@ -1804,6 +1936,10 @@ { "title": "Broadcasted declare transaction V2", "$ref": "#/components/schemas/BROADCASTED_DECLARE_TXN_V2" + }, + { + "title": "Broadcasted declare transaction V3", + "$ref": "#/components/schemas/BROADCASTED_DECLARE_TXN_V3" } ] }, @@ -1913,7 +2049,119 @@ } ] }, + "BROADCASTED_DECLARE_TXN_V3": { + "title": "Broadcasted declare Transaction V2", + "description": "Broadcasted declare Contract Transaction V2", + "allOf": [ + { + "type": "object", + "title": "Declare txn v2", + "properties": { + "type": { + "title": "Declare", + "type": "string", + "enum": [ + "DECLARE" + ] + }, + "sender_address": { + "title": "Sender address", + "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", + "description": "The maximal fee that can be charged for including the transaction" + }, + "version": { + "title": "Version", + "description": "Version of the transaction scheme", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "signature": { + "title": "Signature", + "$ref": "#/components/schemas/SIGNATURE" + }, + "nonce": { + "title": "Nonce", + "$ref": "#/components/schemas/FELT" + }, + "contract_class": { + "title": "Contract class", + "description": "The class to be declared", + "$ref": "#/components/schemas/CONTRACT_CLASS" + }, + "l1_gas": { + "title": "L1 Gas", + "description": "The max amount and max price per unit of L1 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + }, + "l2_gas": { + "title": "L2 Gas", + "description": "The max amount and max price per unit of L2 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + }, + "tip": { + "title": "Tip", + "$ref": "#/components/schemas/FELT", + "description": "the tip for the transaction" + }, + "paymaster_address": { + "title": "Paymaster", + "$ref": "#/components/schemas/ADDRESS", + "description": "the address of the paymaster that pays for the tx in native tokens, 0 if no paymaster is used" + }, + "nonce_data_availability_mode": { + "title": "Nonce DA mode", + "description": "The storage domain of the account's nonce (an account has a nonce per DA mode)", + "$ref": "#/components/schemas/DA_MODE" + }, + "fee_data_availability_mode": { + "title": "Fee DA mode", + "description": "The storage domain of the account's balance from which fee will be charged", + "$ref": "#/components/schemas/DA_MODE" + } + }, + "required": [ + "type", + "sender_address", + "compiled_class_hash", + "max_fee", + "version", + "signature", + "nonce", + "contract_class", + "l1_gas", + "l2_gas", + "tip", + "paymaster_address", + "nonce_data_availability_mode", + "fee_data_availability_mode" + ] + } + ] + }, "DEPLOY_ACCOUNT_TXN": { + "title": "Deploy account transaction", + "description": "deploys a new account contract", + "oneOf": [ + { + "title": "Deploy account V1", + "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN_V1" + }, + { + "title": "Deploy account V3", + "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN_V3" + } + ] + }, + "DEPLOY_ACCOUNT_TXN_V1": { "title": "Deploy account transaction", "description": "Deploys an account contract, charges fee from the pre-funded account addresses", "properties": { @@ -1972,6 +2220,101 @@ "class_hash" ] }, + "DEPLOY_ACCOUNT_TXN_V3": { + "title": "Deploy account transaction", + "description": "Deploys an account contract, charges fee from the pre-funded account addresses", + "properties": { + "type": { + "title": "Deploy account", + "type": "string", + "enum": [ + "DEPLOY_ACCOUNT" + ] + }, + "max_fee": { + "title": "Max fee", + "$ref": "#/components/schemas/FELT", + "description": "The maximal fee that can be charged for including the transaction" + }, + "version": { + "title": "Version", + "description": "Version of the transaction scheme", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "signature": { + "title": "Signature", + "$ref": "#/components/schemas/SIGNATURE" + }, + "nonce": { + "title": "Nonce", + "$ref": "#/components/schemas/FELT" + }, + "contract_address_salt": { + "title": "Contract address salt", + "description": "The salt for the address of the deployed contract", + "$ref": "#/components/schemas/FELT" + }, + "constructor_calldata": { + "type": "array", + "description": "The parameters passed to the constructor", + "title": "Constructor calldata", + "items": { + "$ref": "#/components/schemas/FELT" + } + }, + "class_hash": { + "title": "Class hash", + "description": "The hash of the deployed contract's class", + "$ref": "#/components/schemas/FELT" + }, + "l1_gas": { + "title": "L1 Gas", + "description": "The max amount and max price per unit of L1 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + }, + "l2_gas": { + "title": "L2 Gas", + "description": "The max amount and max price per unit of L2 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + }, + "tip": { + "title": "Tip", + "$ref": "#/components/schemas/FELT", + "description": "the tip for the transaction" + }, + "paymaster_address": { + "title": "Paymaster", + "$ref": "#/components/schemas/ADDRESS", + "description": "the address of the paymaster that pays for the tx in native tokens, 0 if no paymaster is used" + }, + "nonce_data_availability_mode": { + "title": "Nonce DA mode", + "description": "The storage domain of the account's nonce (an account has a nonce per DA mode)", + "$ref": "#/components/schemas/DA_MODE" + }, + "fee_data_availability_mode": { + "title": "Fee DA mode", + "description": "The storage domain of the account's balance from which fee will be charged", + "$ref": "#/components/schemas/DA_MODE" + } + }, + "required": [ + "max_fee", + "version", + "signature", + "nonce", + "type", + "contract_address_salt", + "constructor_calldata", + "class_hash", + "l1_gas", + "l2_gas", + "tip", + "paymaster_address", + "nonce_data_availability_mode", + "fee_data_availability_mode" + ] + }, "DEPLOY_TXN": { "title": "Deploy Contract Transaction", "description": "The structure of a deploy transaction. Note that this transaction type is deprecated and will no longer be supported in future versions", @@ -2133,6 +2476,94 @@ } ] }, + "INVOKE_TXN_V3": { + "title": "Invoke transaction V3", + "description": "initiates a transaction from a given account", + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "title": "Type", + "type": "string", + "enum": [ + "INVOKE" + ] + }, + "sender_address": { + "title": "sender address", + "$ref": "#/components/schemas/ADDRESS" + }, + "calldata": { + "type": "array", + "title": "calldata", + "description": "The data expected by the account's `execute` function (in most usecases, this includes the called contract address and a function selector)", + "items": { + "$ref": "#/components/schemas/FELT" + } + }, + "version": { + "title": "Version", + "description": "Version of the transaction scheme", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "signature": { + "title": "Signature", + "$ref": "#/components/schemas/SIGNATURE" + }, + "nonce": { + "title": "Nonce", + "$ref": "#/components/schemas/FELT" + }, + "l1_gas": { + "title": "L1 Gas", + "description": "The max amount and max price per unit of L1 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + }, + "l2_gas": { + "title": "L2 Gas", + "description": "The max amount and max price per unit of L2 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + }, + "tip": { + "title": "Tip", + "$ref": "#/components/schemas/FELT", + "description": "the tip for the transaction" + }, + "paymaster_address": { + "title": "Paymaster", + "$ref": "#/components/schemas/ADDRESS", + "description": "the address of the paymaster that pays for the tx in native tokens, 0 if no paymaster is used" + }, + "nonce_data_availability_mode": { + "title": "Nonce DA mode", + "description": "The storage domain of the account's nonce (an account has a nonce per DA mode)", + "$ref": "#/components/schemas/DA_MODE" + }, + "fee_data_availability_mode": { + "title": "Fee DA mode", + "description": "The storage domain of the account's balance from which fee will be charged", + "$ref": "#/components/schemas/DA_MODE" + } + }, + "required": [ + "type", + "sender_address", + "calldata", + "max_fee", + "version", + "signature", + "nonce", + "l1_gas", + "l2_gas", + "tip", + "paymaster_address", + "nonce_data_availability_mode", + "fee_data_availability_mode" + ] + } + ] + }, "INVOKE_TXN": { "title": "Invoke transaction", "description": "Initiate a transaction from an account", @@ -2144,6 +2575,10 @@ { "title": "Invoke transaction V1", "$ref": "#/components/schemas/INVOKE_TXN_V1" + }, + { + "title": "Invoke transaction V3", + "$ref": "#/components/schemas/INVOKE_TXN_V3" } ] }, @@ -2236,6 +2671,11 @@ "items": { "$ref": "#/components/schemas/EVENT" } + }, + "execution_reources": { + "title": "Execution resources", + "description": "The resources consumed by the transaction", + "$ref": "#/components/schemas/EXECUTION_RESOURCES" } }, "required": [ @@ -2274,6 +2714,31 @@ } ] }, + "PENDING_INVOKE_TXN_RECEIPT": { + "title": "Invoke Transaction Receipt", + "allOf": [ + { + "title": "Type", + "type": "object", + "properties": { + "type": { + "title": "Type", + "type": "string", + "enum": [ + "INVOKE" + ] + } + }, + "required": [ + "type" + ] + }, + { + "title": "Common receipt properties", + "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" + } + ] + }, "DECLARE_TXN_RECEIPT": { "title": "Declare Transaction Receipt", "allOf": [ @@ -2299,6 +2764,31 @@ } ] }, + "PENDING_DECLARE_TXN_RECEIPT": { + "title": "Declare Transaction Receipt", + "allOf": [ + { + "title": "Declare txn receipt", + "type": "object", + "properties": { + "type": { + "title": "Declare", + "type": "string", + "enum": [ + "DECLARE" + ] + } + }, + "required": [ + "type" + ] + }, + { + "title": "Common receipt properties", + "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" + } + ] + }, "DEPLOY_ACCOUNT_TXN_RECEIPT": { "title": "Deploy Account Transaction Receipt", "allOf": [ @@ -2330,6 +2820,37 @@ } ] }, + "PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT": { + "title": "Deploy Account Transaction Receipt", + "allOf": [ + { + "title": "Common receipt properties", + "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" + }, + { + "title": "DeployAccount txn receipt", + "type": "object", + "properties": { + "type": { + "title": "Deploy account", + "type": "string", + "enum": [ + "DEPLOY_ACCOUNT" + ] + }, + "contract_address": { + "title": "Contract address", + "description": "The address of the deployed contract", + "$ref": "#/components/schemas/FELT" + } + }, + "required": [ + "type", + "contract_address" + ] + } + ] + }, "DEPLOY_TXN_RECEIPT": { "title": "Deploy Transaction Receipt", "allOf": [ @@ -2375,10 +2896,16 @@ "enum": [ "L1_HANDLER" ] + }, + "message_hash": { + "title": "Message hash", + "description": "The message hash as it appears on the L1 core contract", + "$ref": "#/components/schemas/NUM_AS_HEX" } }, "required": [ - "type" + "type", + "message_hash" ] }, { @@ -2387,6 +2914,38 @@ } ] }, + "PENDING_L1_HANDLER_TXN_RECEIPT": { + "title": "L1 Handler Transaction Receipt", + "description": "receipt for l1 handler transaction", + "allOf": [ + { + "title": "Transaction type", + "type": "object", + "properties": { + "type": { + "title": "type", + "type": "string", + "enum": [ + "L1_HANDLER" + ] + }, + "message_hash": { + "title": "Message hash", + "description": "The message hash as it appears on the L1 core contract", + "$ref": "#/components/schemas/NUM_AS_HEX" + } + }, + "required": [ + "type", + "message_hash" + ] + }, + { + "title": "Common receipt properties", + "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" + } + ] + }, "TXN_RECEIPT": { "title": "Transaction Receipt", "oneOf": [ @@ -2409,10 +2968,27 @@ { "title": "Deploy account transaction receipt", "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN_RECEIPT" + } + ] + }, + "PENDING_TXN_RECEIPT": { + "title": "Transaction Receipt", + "oneOf": [ + { + "title": "Pending Invoke transaction receipt", + "$ref": "#/components/schemas/PENDING_INVOKE_TXN_RECEIPT" + }, + { + "title": "Pending L1 handler transaction receipt", + "$ref": "#/components/schemas/PENDING_L1_HANDLER_TXN_RECEIPT" }, { - "title": "Pending transaction receipt", - "$ref": "#/components/schemas/PENDING_TXN_RECEIPT" + "title": "Pending Declare transaction receipt", + "$ref": "#/components/schemas/PENDING_DECLARE_TXN_RECEIPT" + }, + { + "title": "Pending Deploy account transaction receipt", + "$ref": "#/components/schemas/PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT" } ] }, @@ -2464,9 +3040,10 @@ ], "description": "The finality status of the transaction" }, - "execution_status": { - "title": "Execution status", - "$ref": "#/components/schemas/TXN_EXECUTION_STATUS" + "execution_reources": { + "title": "Execution resources", + "description": "The resources consumed by the transaction", + "$ref": "#/components/schemas/EXECUTION_RESOURCES" } }, "required": [ @@ -2479,40 +3056,6 @@ "execution_status" ] }, - "PENDING_DEPLOY_TXN_RECEIPT": { - "title": "Pending deploy Transaction Receipt", - "allOf": [ - { - "title": "Common receipt properties", - "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" - }, - { - "type": "object", - "title": "Contract address", - "properties": { - "contract_address": { - "title": "Contract address", - "description": "The address of the deployed contract", - "$ref": "#/components/schemas/FELT" - } - } - } - ] - }, - "PENDING_TXN_RECEIPT": { - "title": "Pending Transaction Receipt", - "oneOf": [ - { - "title": "Pending deploy transaction receipt", - "$ref": "#/components/schemas/PENDING_DEPLOY_TXN_RECEIPT" - }, - { - "title": "Pending common receipt properties", - "$comment": "Used for pending invoke and declare transaction receipts", - "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" - } - ] - }, "MSG_TO_L1": { "title": "Message to L1", "type": "object", @@ -3019,6 +3562,96 @@ "gas_price", "overall_fee" ] + }, + "DA_MODE": { + "title": "DA mode", + "type": "string", + "description": "Specifies a storage domain in Starknet. Each domain has different gurantess regarding availability", + "enum": [ + "L1", + "L2" + ] + }, + "RESOURCE_LIMITS": { + "type": "object", + "properties": { + "max_amount": { + "title": "max amount", + "description": "the max amount of the resource that can be used in the tx", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "max_price_per_unit": { + "title": "max price", + "description": "the max price per unit of this resource for this tx", + "$ref": "#/components/schemas/NUM_AS_HEX" + } + }, + "required": [ + "max_amount", + "max_price_per_unit" + ] + }, + "EXECUTION_RESOURCES": { + "title": "Execution resources", + "description": "The resources consumed by the transaction", + "type": "object", + "properties": { + "steps": { + "title": "Steps", + "description": "The number of Cairo steps used", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "memory_holes": { + "title": "Memory holes", + "description": "The number of memory holes caused by the tx (a memory hole is a wasted memory cell, and is roughly equivalent to half a step)", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "range_check_builtin_applications": { + "title": "Range check applications", + "description": "The number of RANGE_CHECK builtin instances", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "pedersen_builtin_applications": { + "title": "Pedersen applications", + "description": "The number of Pedersen builtin instances", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "poseidon_builtin_applications": { + "title": "Poseidon applications", + "description": "The number of Poseidon builtin instances", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "ec_op_builtin_applications": { + "title": "EC_OP applications", + "description": "the number of EC_OP builtin instances", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "ecdsa_builtin_applications": { + "title": "ECDSA applications", + "description": "the number of ECDSA builtin instances", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "bitwise_builtin_applications": { + "title": "BITWISE applications", + "description": "the number of BITWISE builtin instances", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "keccak_builtin_applications": { + "title": "Keccak applications", + "description": "The number of KECCAK builtin instances", + "$ref": "#/components/schemas/NUM_AS_HEX" + } + }, + "required": [ + "steps", + "range_check_builtin_applications", + "pedersen_builtin_applications", + "poseidon_builtin_applications", + "ec_op_builtin_applications", + "ecdsa_builtin_applications", + "bitwise_builtin_applications", + "keccak_builtin_applications" + ] } }, "errors": { From db4688128328cf87204199178da98abf237bc5d1 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Fri, 1 Sep 2023 22:01:13 -0700 Subject: [PATCH 2/7] add type to traces --- api/starknet_api_openrpc.json | 2 +- api/starknet_trace_api_openrpc.json | 57 +++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index 665c7da..7c7b09e 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -1283,7 +1283,7 @@ "type": "object", "properties": { "transactions": { - "title": "Transaction", + "title": "Transaction hashes", "description": "The hashes of the transactions included in this block", "type": "array", "items": { diff --git a/api/starknet_trace_api_openrpc.json b/api/starknet_trace_api_openrpc.json index 2daa475..2d5dabe 100644 --- a/api/starknet_trace_api_openrpc.json +++ b/api/starknet_trace_api_openrpc.json @@ -180,8 +180,21 @@ }, "fee_transfer_invocation": { "$ref": "#/components/schemas/FUNCTION_INVOCATION" + }, + "type": { + "title": "Type", + "type": "string", + "enum": [ + "INVOKE" + ] } - } + }, + "required": [ + "validate_invocation", + "execute_invocation", + "fee_transfer_invocation", + "type" + ] }, { "name": "DECLARE_TXN_TRACE", @@ -193,8 +206,20 @@ }, "fee_transfer_invocation": { "$ref": "#/components/schemas/FUNCTION_INVOCATION" + }, + "type": { + "title": "Type", + "type": "string", + "enum": [ + "DECLARE" + ] } - } + }, + "required": [ + "validate_invocation", + "fee_transfer_invocation", + "type" + ] }, { "name": "DEPLOY_ACCOUNT_TXN_TRACE", @@ -210,8 +235,21 @@ }, "fee_transfer_invocation": { "$ref": "#/components/schemas/FUNCTION_INVOCATION" + }, + "type": { + "title": "Type", + "type": "string", + "enum": [ + "DEPLOY_ACCOUNT" + ] } - } + }, + "required": [ + "validate_invocation", + "constructor_invocation", + "fee_transfer_invocation", + "type" + ] }, { "name": "L1_HANDLER_TXN_TRACE", @@ -221,8 +259,19 @@ "function_invocation": { "description": "the trace of the __execute__ call or constructor call, depending on the transaction type (none for declare transactions)", "$ref": "#/components/schemas/FUNCTION_INVOCATION" + }, + "type": { + "title": "Type", + "type": "string", + "enum": [ + "L1_HANDLER" + ] } - } + }, + "required": [ + "function_invocation", + "type" + ] } ] }, From 5d266c19059dbf86dac61f8da294d1f207aad1f3 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Sun, 10 Sep 2023 09:25:25 +0300 Subject: [PATCH 3/7] remove future resources, add gas price units to block --- api/starknet_api_openrpc.json | 176 +++++----------------------- api/starknet_trace_api_openrpc.json | 9 +- 2 files changed, 31 insertions(+), 154 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index 7c7b09e..ba5d807 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -1369,7 +1369,7 @@ "l1_gas_price": { "title": "L1 gas price", "descritpion": "The price of l1 gas in the block", - "$ref": "#/components/schemas/NUM_AS_HEX" + "$ref": "#/components/schemas/RESOURCE_PRICE" }, "starknet_version": { "title": "Starknet version", @@ -1796,12 +1796,12 @@ ] }, "DECLARE_TXN_V3": { - "title": "Declare Transaction V2", - "description": "Declare Contract Transaction V2", + "title": "Declare Transaction V3", + "description": "Declare Contract Transaction V3", "allOf": [ { "type": "object", - "title": "Declare txn v2", + "title": "Declare txn v3", "properties": { "type": { "title": "Declare", @@ -1820,17 +1820,12 @@ "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", - "description": "The maximal fee that can be charged for including the transaction" - }, "version": { "title": "Version", "description": "Version of the transaction scheme", "type": "string", "enum": [ - "0x2" + "0x3" ] }, "signature": { @@ -1850,31 +1845,6 @@ "title": "L1 Gas", "description": "The max amount and max price per unit of L1 gas used in this tx", "$ref": "#/components/schemas/RESOURCE_LIMITS" - }, - "l2_gas": { - "title": "L2 Gas", - "description": "The max amount and max price per unit of L2 gas used in this tx", - "$ref": "#/components/schemas/RESOURCE_LIMITS" - }, - "tip": { - "title": "Tip", - "$ref": "#/components/schemas/FELT", - "description": "the tip for the transaction" - }, - "paymaster_address": { - "title": "Paymaster", - "$ref": "#/components/schemas/ADDRESS", - "description": "the address of the paymaster that pays for the tx in native tokens, 0 if no paymaster is used" - }, - "nonce_data_availability_mode": { - "title": "Nonce DA mode", - "description": "The storage domain of the account's nonce (an account has a nonce per DA mode)", - "$ref": "#/components/schemas/DA_MODE" - }, - "fee_data_availability_mode": { - "title": "Fee DA mode", - "description": "The storage domain of the account's balance from which fee will be charged", - "$ref": "#/components/schemas/DA_MODE" } }, "required": [ @@ -1886,12 +1856,7 @@ "signature", "nonce", "class_hash", - "l1_gas", - "l2_gas", - "tip", - "paymaster_address", - "nonce_data_availability_mode", - "fee_data_availability_mode" + "l1_gas" ] } ] @@ -1917,7 +1882,7 @@ "$ref": "#/components/schemas/INVOKE_TXN_V1" }, { - "title": "Broadcasted invoke transaction V2", + "title": "Broadcasted invoke transaction V3", "$ref": "#/components/schemas/INVOKE_TXN_V3" } ] @@ -2050,12 +2015,12 @@ ] }, "BROADCASTED_DECLARE_TXN_V3": { - "title": "Broadcasted declare Transaction V2", - "description": "Broadcasted declare Contract Transaction V2", + "title": "Broadcasted declare Transaction V3", + "description": "Broadcasted declare Contract Transaction V3", "allOf": [ { "type": "object", - "title": "Declare txn v2", + "title": "Declare txn v3", "properties": { "type": { "title": "Declare", @@ -2074,11 +2039,6 @@ "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", - "description": "The maximal fee that can be charged for including the transaction" - }, "version": { "title": "Version", "description": "Version of the transaction scheme", @@ -2101,31 +2061,6 @@ "title": "L1 Gas", "description": "The max amount and max price per unit of L1 gas used in this tx", "$ref": "#/components/schemas/RESOURCE_LIMITS" - }, - "l2_gas": { - "title": "L2 Gas", - "description": "The max amount and max price per unit of L2 gas used in this tx", - "$ref": "#/components/schemas/RESOURCE_LIMITS" - }, - "tip": { - "title": "Tip", - "$ref": "#/components/schemas/FELT", - "description": "the tip for the transaction" - }, - "paymaster_address": { - "title": "Paymaster", - "$ref": "#/components/schemas/ADDRESS", - "description": "the address of the paymaster that pays for the tx in native tokens, 0 if no paymaster is used" - }, - "nonce_data_availability_mode": { - "title": "Nonce DA mode", - "description": "The storage domain of the account's nonce (an account has a nonce per DA mode)", - "$ref": "#/components/schemas/DA_MODE" - }, - "fee_data_availability_mode": { - "title": "Fee DA mode", - "description": "The storage domain of the account's balance from which fee will be charged", - "$ref": "#/components/schemas/DA_MODE" } }, "required": [ @@ -2137,12 +2072,7 @@ "signature", "nonce", "contract_class", - "l1_gas", - "l2_gas", - "tip", - "paymaster_address", - "nonce_data_availability_mode", - "fee_data_availability_mode" + "l1_gas" ] } ] @@ -2231,11 +2161,6 @@ "DEPLOY_ACCOUNT" ] }, - "max_fee": { - "title": "Max fee", - "$ref": "#/components/schemas/FELT", - "description": "The maximal fee that can be charged for including the transaction" - }, "version": { "title": "Version", "description": "Version of the transaction scheme", @@ -2271,31 +2196,6 @@ "title": "L1 Gas", "description": "The max amount and max price per unit of L1 gas used in this tx", "$ref": "#/components/schemas/RESOURCE_LIMITS" - }, - "l2_gas": { - "title": "L2 Gas", - "description": "The max amount and max price per unit of L2 gas used in this tx", - "$ref": "#/components/schemas/RESOURCE_LIMITS" - }, - "tip": { - "title": "Tip", - "$ref": "#/components/schemas/FELT", - "description": "the tip for the transaction" - }, - "paymaster_address": { - "title": "Paymaster", - "$ref": "#/components/schemas/ADDRESS", - "description": "the address of the paymaster that pays for the tx in native tokens, 0 if no paymaster is used" - }, - "nonce_data_availability_mode": { - "title": "Nonce DA mode", - "description": "The storage domain of the account's nonce (an account has a nonce per DA mode)", - "$ref": "#/components/schemas/DA_MODE" - }, - "fee_data_availability_mode": { - "title": "Fee DA mode", - "description": "The storage domain of the account's balance from which fee will be charged", - "$ref": "#/components/schemas/DA_MODE" } }, "required": [ @@ -2307,12 +2207,7 @@ "contract_address_salt", "constructor_calldata", "class_hash", - "l1_gas", - "l2_gas", - "tip", - "paymaster_address", - "nonce_data_availability_mode", - "fee_data_availability_mode" + "l1_gas" ] }, "DEPLOY_TXN": { @@ -2519,31 +2414,6 @@ "title": "L1 Gas", "description": "The max amount and max price per unit of L1 gas used in this tx", "$ref": "#/components/schemas/RESOURCE_LIMITS" - }, - "l2_gas": { - "title": "L2 Gas", - "description": "The max amount and max price per unit of L2 gas used in this tx", - "$ref": "#/components/schemas/RESOURCE_LIMITS" - }, - "tip": { - "title": "Tip", - "$ref": "#/components/schemas/FELT", - "description": "the tip for the transaction" - }, - "paymaster_address": { - "title": "Paymaster", - "$ref": "#/components/schemas/ADDRESS", - "description": "the address of the paymaster that pays for the tx in native tokens, 0 if no paymaster is used" - }, - "nonce_data_availability_mode": { - "title": "Nonce DA mode", - "description": "The storage domain of the account's nonce (an account has a nonce per DA mode)", - "$ref": "#/components/schemas/DA_MODE" - }, - "fee_data_availability_mode": { - "title": "Fee DA mode", - "description": "The storage domain of the account's balance from which fee will be charged", - "$ref": "#/components/schemas/DA_MODE" } }, "required": [ @@ -2554,12 +2424,7 @@ "version", "signature", "nonce", - "l1_gas", - "l2_gas", - "tip", - "paymaster_address", - "nonce_data_availability_mode", - "fee_data_availability_mode" + "l1_gas" ] } ] @@ -3591,6 +3456,21 @@ "max_price_per_unit" ] }, + "RESOURCE_PRICE": { + "type": "object", + "properties": { + "price_in_strk": { + "title": "price in strk", + "description": "the price of one unit of the given resource, denominated in strk", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "price_in_wei": { + "title": "price in wei", + "description": "the price of one unit of the given resource, denominated in wei", + "$ref": "#/components/schemas/NUM_AS_HEX" + } + } + }, "EXECUTION_RESOURCES": { "title": "Execution resources", "description": "The resources consumed by the transaction", diff --git a/api/starknet_trace_api_openrpc.json b/api/starknet_trace_api_openrpc.json index 2d5dabe..c78b51f 100644 --- a/api/starknet_trace_api_openrpc.json +++ b/api/starknet_trace_api_openrpc.json @@ -113,11 +113,11 @@ "description": "Returns the execution traces of all transactions included in the given block", "params": [ { - "name": "block_hash", - "summary": "The hash of the requested block", + "name": "block_id", + "description": "The hash of the requested block, or number (height) of the requested block, or a block tag", "required": true, "schema": { - "$ref": "#/components/schemas/BLOCK_HASH" + "$ref": "#/components/schemas/BLOCK_ID" } } ], @@ -373,9 +373,6 @@ "MSG_TO_L1": { "$ref": "./starknet_api_openrpc.json#/components/schemas/MSG_TO_L1" }, - "BLOCK_HASH": { - "$ref": "./starknet_api_openrpc.json#/components/schemas/BLOCK_HASH" - }, "BLOCK_ID": { "$ref": "./starknet_api_openrpc.json#/components/schemas/BLOCK_ID" }, From 83f925d0e3bcfb28921cc44ab1ea27b6cead8a85 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Sun, 10 Sep 2023 10:46:10 +0300 Subject: [PATCH 4/7] add specVersion endpoint and re-allow v0 invoke txs --- api/starknet_api_openrpc.json | 31 ++++++++++++++++++----------- api/starknet_trace_api_openrpc.json | 2 +- api/starknet_write_api.json | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index ba5d807..84b8845 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -1,12 +1,26 @@ { "openrpc": "1.0.0-rc1", "info": { - "version": "0.4.0", + "version": "0.5.0", "title": "StarkNet Node API", "license": {} }, "servers": [], "methods": [ + { + "name": "starknet_specVersion", + "summary": "Returns the version of the Starknet JSON-RPC spec being used", + "params": [], + "result": { + "name": "result", + "description": "Semver of Starknet's JSON-RPC spec being used", + "required": true, + "schema": { + "title": "JSON-RPC spec version", + "type": "string" + } + } + }, { "name": "starknet_getBlockWithTxHashes", "summary": "Get block information with transaction hashes given the block id", @@ -1383,7 +1397,9 @@ "block_number", "new_root", "timestamp", - "sequencer_address" + "sequencer_address", + "l1_gas_price", + "starknet_version" ] }, "BLOCK_WITH_TX_HASHES": { @@ -1876,16 +1892,7 @@ }, "BROADCASTED_INVOKE_TXN": { "title": "Broadcasted invoke transaction", - "oneOf": [ - { - "title": "Broadcasted invoke transaction V1", - "$ref": "#/components/schemas/INVOKE_TXN_V1" - }, - { - "title": "Broadcasted invoke transaction V3", - "$ref": "#/components/schemas/INVOKE_TXN_V3" - } - ] + "$ref": "#/components/schemas/INVOKE_TXN" }, "BROADCASTED_DEPLOY_ACCOUNT_TXN": { "title": "Broadcasted deploy account transaction", diff --git a/api/starknet_trace_api_openrpc.json b/api/starknet_trace_api_openrpc.json index c78b51f..f7e5fc8 100644 --- a/api/starknet_trace_api_openrpc.json +++ b/api/starknet_trace_api_openrpc.json @@ -1,7 +1,7 @@ { "openrpc": "1.0.0-rc1", "info": { - "version": "0.4.0", + "version": "0.5.0", "title": "StarkNet Trace API", "license": {} }, diff --git a/api/starknet_write_api.json b/api/starknet_write_api.json index 1887628..cc9a79c 100644 --- a/api/starknet_write_api.json +++ b/api/starknet_write_api.json @@ -1,7 +1,7 @@ { "openrpc": "1.0.0-rc1", "info": { - "version": "0.4.0", + "version": "0.5.0", "title": "StarkNet Node Write API", "license": {} }, From 2bbe96f854d70794f42a7ba308dbb6ac2292cfad Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Sun, 10 Sep 2023 13:14:32 +0300 Subject: [PATCH 5/7] remove v3 from broadcasted_txn until the relevant Starknet upgrade --- api/starknet_api_openrpc.json | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index 84b8845..12c3c71 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -9,7 +9,7 @@ "methods": [ { "name": "starknet_specVersion", - "summary": "Returns the version of the Starknet JSON-RPC spec being used", + "summary": "Returns the version of the Starknet JSON-RPC specification being used", "params": [], "result": { "name": "result", @@ -1892,7 +1892,16 @@ }, "BROADCASTED_INVOKE_TXN": { "title": "Broadcasted invoke transaction", - "$ref": "#/components/schemas/INVOKE_TXN" + "oneOf": [ + { + "title": "Broadcasted invoke transaction V0", + "$ref": "#/components/schemas/INVOKE_TXN_V0" + }, + { + "title": "Broadcasted invoke transaction V1", + "$ref": "#/components/schemas/INVOKE_TXN_V1" + } + ] }, "BROADCASTED_DEPLOY_ACCOUNT_TXN": { "title": "Broadcasted deploy account transaction", @@ -3476,7 +3485,10 @@ "description": "the price of one unit of the given resource, denominated in wei", "$ref": "#/components/schemas/NUM_AS_HEX" } - } + }, + "required": [ + "price_in_wei" + ] }, "EXECUTION_RESOURCES": { "title": "Execution resources", @@ -3490,7 +3502,7 @@ }, "memory_holes": { "title": "Memory holes", - "description": "The number of memory holes caused by the tx (a memory hole is a wasted memory cell, and is roughly equivalent to half a step)", + "description": "The number of unused memory cells (each cell is roughly equivalent to a step)", "$ref": "#/components/schemas/NUM_AS_HEX" }, "range_check_builtin_applications": { From 8f933168c2446d0f8d216044d70ba78580006691 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Wed, 13 Sep 2023 19:46:28 +0300 Subject: [PATCH 6/7] add ordering to trace events and messages --- api/starknet_trace_api_openrpc.json | 59 ++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/api/starknet_trace_api_openrpc.json b/api/starknet_trace_api_openrpc.json index f7e5fc8..8a5e16a 100644 --- a/api/starknet_trace_api_openrpc.json +++ b/api/starknet_trace_api_openrpc.json @@ -331,7 +331,12 @@ "description": "The events emitted in this invocation", "type": "array", "items": { - "$ref": "#/components/schemas/EVENT" + "allOf": [ + {}, + { + "$ref": "#/components/schemas/EVENT" + } + ] } }, "messages": { @@ -342,7 +347,17 @@ "$ref": "#/components/schemas/MSG_TO_L1" } } - } + }, + "required": [ + "caller_address", + "class_hash", + "entry_point_type", + "call_type", + "result", + "calls", + "events", + "messages" + ] } ] }, @@ -361,6 +376,46 @@ "CALL" ] }, + "ORDERED_EVENT": { + "type": "object", + "title": "orderedEvent", + "description": "an event alongside its order within the transaction", + "allOf": [ + { + "type": "object", + "properties": { + "order": { + "title": "order", + "description": "the order of the event within the transaction", + "type": "number" + } + } + }, + { + "$ref": "#/components/schemas/EVENT" + } + ] + }, + "ORDERED_MESSAGE": { + "type": "object", + "title": "orderedMessage", + "description": "a message alongside its order within the transaction", + "allOf": [ + { + "type": "object", + "properties": { + "order": { + "title": "order", + "description": "the order of the message within the transaction", + "type": "number" + } + } + }, + { + "$ref": "#/components/schemas/MSG_TO_L1" + } + ] + }, "FELT": { "$ref": "./starknet_api_openrpc.json#/components/schemas/FELT" }, From df8e2d553e77871ab575048838776ef5565d8040 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Wed, 13 Sep 2023 19:49:51 +0300 Subject: [PATCH 7/7] fix typo --- api/starknet_api_openrpc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index 12c3c71..9494076 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -2553,7 +2553,7 @@ "$ref": "#/components/schemas/EVENT" } }, - "execution_reources": { + "execution_resources": { "title": "Execution resources", "description": "The resources consumed by the transaction", "$ref": "#/components/schemas/EXECUTION_RESOURCES"