Skip to content

Commit 5e83010

Browse files
committed
Merge branch 'develop' into chore/update-openapi-spec
2 parents 602516f + c76743e commit 5e83010

File tree

11 files changed

+948
-16
lines changed

11 files changed

+948
-16
lines changed

docs/rpc/openapi.yaml

Lines changed: 84 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ components:
7373
schema:
7474
type: string
7575
example: "Internal Server Error"
76+
Timeout:
77+
description: Timeout
78+
content:
79+
text/plain:
80+
schema:
81+
type: string
82+
example: "Timeout"
7683
schemas:
7784
NodeInfo:
7885
$ref: ./components/schemas/node-info.schema.yaml
@@ -104,6 +111,8 @@ components:
104111
$ref: ./components/schemas/read-only-function-args.schema.yaml
105112
ReadOnlyFunctionResult:
106113
$ref: ./components/schemas/read-only-function-result.schema.yaml
114+
ClarityName:
115+
$ref: ./components/schemas/clarity-name.schema.yaml
107116
ClarityMetadata:
108117
$ref: ./components/schemas/clarity-metadata.schema.yaml
109118
ConstantValue:
@@ -267,9 +276,8 @@ paths:
267276
- name: map_name
268277
in: path
269278
required: true
270-
description: Map name
271279
schema:
272-
type: string
280+
$ref: "#/components/schemas/ClarityName"
273281
- $ref: ./components/parameters/proof.yaml
274282
- $ref: ./components/parameters/tip.yaml
275283
x-codegen-request-body-name: key
@@ -333,9 +341,13 @@ paths:
333341
description: |
334342
Call a read-only public function on a given contract.
335343
336-
The contract is identified with [Stacks Address] and [Contract Name] in the URL path. The function is identified with [Function Name].
344+
The contract is identified with [Stacks Address] and [Contract Name] in the URL path.
345+
The function is identified with [Function Name].
337346
338-
The arguments to the function are supplied via the POST body. This should be a JSON object with two main properties, `sender` which should be a standard Stacks address and `arguments` which should be an array of hex-encoded Clarity values.
347+
The arguments to the function are supplied via the POST body.
348+
This should be a JSON object with two main properties:
349+
- `sender` which should be a standard Stacks address
350+
- `arguments` which should be an array of hex-encoded Clarity values.
339351
tags:
340352
- Smart Contracts
341353
security: []
@@ -345,17 +357,78 @@ paths:
345357
- $ref: ./components/parameters/contract-name.yaml
346358
- name: function_name
347359
in: path
348-
description: Function name
349360
required: true
350361
schema:
351-
type: string
362+
$ref: "#/components/schemas/ClarityName"
363+
- $ref: ./components/parameters/tip.yaml
364+
requestBody:
365+
required: true
366+
content:
367+
application/json:
368+
schema:
369+
$ref: "#/components/schemas/ReadOnlyFunctionArgs"
370+
responses:
371+
"200":
372+
description: Function executed successfully
373+
content:
374+
application/json:
375+
schema:
376+
$ref: "#/components/schemas/ReadOnlyFunctionResult"
377+
examples:
378+
success:
379+
summary: Successful function call
380+
externalValue: "./components/examples/read-only-function-success.example.json"
381+
failure:
382+
summary: Failed function call
383+
externalValue: "./components/examples/read-only-function-failure.example.json"
384+
"400":
385+
$ref: "#/components/responses/BadRequest"
386+
"404":
387+
$ref: "#/components/responses/NotFound"
388+
"500":
389+
$ref: "#/components/responses/InternalServerError"
390+
391+
/v3/contracts/fast-call-read/{contract_address}/{contract_name}/{function_name}:
392+
post:
393+
summary: Call read-only function in fast mode (no cost and memory tracking)
394+
description: |
395+
Call a read-only public function on a given smart contract without cost tracking.
396+
397+
The contract is identified with [Stacks Address] and [Contract Name] in the URL path.
398+
The function is identified with [Function Name].
399+
400+
The arguments to the function are supplied via the POST body.
401+
This should be a JSON object with two main properties:
402+
- `sender` which should be a standard Stacks address
403+
- `arguments` which should be an array of hex-encoded Clarity values.
404+
405+
**This API endpoint requires a basic Authorization header.**
406+
tags:
407+
- Smart Contracts
408+
security:
409+
- rpcAuth: []
410+
operationId: fastCallReadOnlyFunction
411+
parameters:
412+
- $ref: ./components/parameters/contract-address.yaml
413+
- $ref: ./components/parameters/contract-name.yaml
414+
- name: function_name
415+
in: path
416+
required: true
417+
schema:
418+
$ref: "#/components/schemas/ClarityName"
352419
- $ref: ./components/parameters/tip.yaml
353420
requestBody:
421+
description: map of arguments and the simulated tx-sender where sender is either a Contract identifier or a normal Stacks address, and arguments is an array of hex serialized Clarity values.
354422
required: true
355423
content:
356424
application/json:
357425
schema:
358426
$ref: "#/components/schemas/ReadOnlyFunctionArgs"
427+
example:
428+
sender: "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info"
429+
arguments:
430+
- "0x0011..."
431+
- "0x00231..."
359432
responses:
360433
"200":
361434
description: Function executed successfully
@@ -374,6 +447,8 @@ paths:
374447
$ref: "#/components/responses/BadRequest"
375448
"404":
376449
$ref: "#/components/responses/NotFound"
450+
"408":
451+
$ref: "#/components/responses/Timeout"
377452
"500":
378453
$ref: "#/components/responses/InternalServerError"
379454

@@ -609,12 +684,9 @@ paths:
609684
- name: trait_name
610685
in: path
611686
required: true
612-
description: Trait name, must conform to Clarity naming rules.
613687
schema:
614-
type: string
615-
pattern: "^([a-zA-Z0-9_]|[-!?+<>=/*]){1,128}$"
616-
minLength: 1
617-
maxLength: 128
688+
$ref: "#/components/schemas/ClarityName"
689+
example: "some-trait"
618690
- $ref: ./components/parameters/tip.yaml
619691
responses:
620692
"200":
@@ -739,9 +811,8 @@ paths:
739811
- name: constant_name
740812
in: path
741813
required: true
742-
description: Constant name
743814
schema:
744-
type: string
815+
$ref: "#/components/schemas/ClarityName"
745816
- $ref: ./components/parameters/tip.yaml
746817

747818
/v3/block_proposal:

stackslib/src/config/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3719,6 +3719,13 @@ pub struct ConnectionOptionsFile {
37193719
/// @default: [`DEFAULT_BLOCK_PROPOSAL_MAX_AGE_SECS`]
37203720
/// @units: seconds
37213721
pub block_proposal_max_age_secs: Option<u64>,
3722+
3723+
/// Maximum time (in seconds) that a readonly call in free cost tracking mode
3724+
/// can run before being interrupted
3725+
/// ---
3726+
/// @default: 30
3727+
/// @units: seconds
3728+
pub read_only_max_execution_time_secs: Option<u64>,
37223729
}
37233730

37243731
impl ConnectionOptionsFile {
@@ -3870,6 +3877,9 @@ impl ConnectionOptionsFile {
38703877
block_proposal_max_age_secs: self
38713878
.block_proposal_max_age_secs
38723879
.unwrap_or(DEFAULT_BLOCK_PROPOSAL_MAX_AGE_SECS),
3880+
read_only_max_execution_time_secs: self
3881+
.read_only_max_execution_time_secs
3882+
.unwrap_or(default.read_only_max_execution_time_secs),
38733883
..default
38743884
})
38753885
}

stackslib/src/net/api/callreadonly.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub struct CallReadOnlyResponse {
5959

6060
#[derive(Clone)]
6161
pub struct RPCCallReadOnlyRequestHandler {
62-
maximum_call_argument_size: u32,
62+
pub maximum_call_argument_size: u32,
6363
read_only_call_limit: ExecutionCost,
6464

6565
/// Runtime fields

0 commit comments

Comments
 (0)