Skip to content

Commit 0e9fb5b

Browse files
authored
Merge pull request #6511 from rdeioris/feat/block_simulate_ephemeral_marf
Feat/block simulate ephemeral marf
2 parents 5934517 + 3a009b6 commit 0e9fb5b

File tree

8 files changed

+861
-0
lines changed

8 files changed

+861
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
1313
- Add `stackerdb_timeout_secs` to miner config for limiting duration of StackerDB HTTP requests.
1414
- When determining a global transaction replay set, the state evaluator now uses a longest-common-prefix algorithm to find a replay set in the case where a single replay set has less than 70% of signer weight.
1515
- New endpoints /v3/tenures/blocks/, /v3/tenures/blocks/hash, /v3/tenures/blocks/height allowing retrieving the list of stacks blocks from a burn block
16+
- New authenticated endpoint /v3/block/replay to replay the execution of any Nakamoto block in the chain (useful for validation, simulation, getting events...)
1617
- Creates epoch 3.3 and costs-4 in preparation for a hardfork to activate Clarity 4
1718
- Adds support for new Clarity 4 builtins (not activated until epoch 3.3):
1819
- `contract-hash?`
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"block_hash": "732f57eefc4dbfb015c9988d9943c47273d25fbe039220d53f311b307609c83f",
3+
"block_id": "856f6b08f338164df7422f66337c8ce916b6b0301fcaa09de06c61cfb79e2a45",
4+
"block_height": 123,
5+
"consensus_hash": "33dffda027e2ca3aaf278855c59a8a0b2d2dd51f",
6+
"fees": 1,
7+
"miner_signature": "004b2878d7639060c4d183b1338447c06ceb0ad55424856c550a4c988401fdf8cf1fe6e8c05cc0e3ff8d4383590bf700cb5dd1a8bb3269f7125f6e0704b66eade8",
8+
"parent_block_id": "3ac36fc1acfc86ba80ea27cd26017c675f75bc07fb042814b72e74cd7d331503",
9+
"signer_signature": [
10+
"00d4e08331db614d18d7b5af53cf9bc03add9c7a2dcb6f0448721de7ea98f662cf7dc43ee73e14d18dfae3d3d349ff67e0fd773a446fb8c949c93ae4676f4d34bc",
11+
"01619c6e69bad5b43e11bae3eb4d4626e5cf19d595923b0b5d2053e8883a266b41315fdaefd1eca03c5c0580b0f7fd28053c3f34eb0a12220b61392d342f5afb0d",
12+
"0078fa352e0e4d2d94b25d4070ae24a819f268b2260a1e4d0d867415dbdc39e2cf75e57de69375794073e22a75873a5e1ca33ed96eadd8086415e934f697b78fdb",
13+
"00b8d9b0d0cdfabe3c65237801e714185777f60507c773fcd2a72ed00b9d4c59cb5ab96e0e8d545bd562b5ca3de6db1d3b9fccd8f41c3bfa7de3528deb1acd30d6"
14+
],
15+
"state_index_root": "839b826290027e5b92de415495be7bab2eab2ad4e2f8c371a1a773ae552fedba",
16+
"timestamp": 1758284349,
17+
"transactions": [
18+
{
19+
"data": {
20+
"anchor_mode": "OnChainOnly",
21+
"auth": {
22+
"Standard": {
23+
"Singlesig": {
24+
"hash_mode": "P2PKH",
25+
"key_encoding": "Compressed",
26+
"nonce": 99,
27+
"signature": "01e29229b386e1f69ffd91e339c878246235ec1cd4771b42a7f45e1ed108643bc9417d43dd96a02c93314ef4cf5bcbcc5642df2e1f5a177333ff983c8719d80661",
28+
"signer": "2965a4e6e4226868fa3ae88b2b9bb9e937d77fba",
29+
"tx_fee": 1
30+
}
31+
}
32+
},
33+
"chain_id": 2147483648,
34+
"payload": {
35+
"TokenTransfer": [
36+
{
37+
"Standard": [
38+
26,
39+
[
40+
189,
41+
65,
42+
200,
43+
147,
44+
188,
45+
192,
46+
157,
47+
152,
48+
224,
49+
211,
50+
77,
51+
255,
52+
135,
53+
190,
54+
175,
55+
153,
56+
88,
57+
51,
58+
140,
59+
222
60+
]
61+
]
62+
},
63+
1,
64+
"00000000000000000000000000000000000000000000000000000000000000000000"
65+
]
66+
},
67+
"post_condition_mode": "Deny",
68+
"post_conditions": [],
69+
"version": "Testnet"
70+
},
71+
"events": [
72+
{
73+
"committed": true,
74+
"event_index": 0,
75+
"stx_transfer_event": {
76+
"amount": "1",
77+
"memo": "00000000000000000000000000000000000000000000000000000000000000000000",
78+
"recipient": "ST2YM3J4KQK09V670TD6ZZ1XYNYCNGCWCVTASN5VM",
79+
"sender": "STMPB976WGH6GT7T7BM8PAWVQ7MKFNVZQAXS4BFS"
80+
},
81+
"txid": "0xf14dd7dec56405fd7dac69c3080fb569fae4c49c591f9ad0e5cf5c797add9005",
82+
"type": "stx_transfer_event"
83+
}
84+
],
85+
"execution_cost": {
86+
"read_count": 0,
87+
"read_length": 0,
88+
"runtime": 0,
89+
"write_count": 0,
90+
"write_length": 0
91+
},
92+
"hex": "808000000004002965a4e6e4226868fa3ae88b2b9bb9e937d77fba000000000000006300000000000000010001e29229b386e1f69ffd91e339c878246235ec1cd4771b42a7f45e1ed108643bc9417d43dd96a02c93314ef4cf5bcbcc5642df2e1f5a177333ff983c8719d8066101020000000000051abd41c893bcc09d98e0d34dff87beaf9958338cde000000000000000100000000000000000000000000000000000000000000000000000000000000000000",
93+
"result": {
94+
"Response": {
95+
"committed": true,
96+
"data": {
97+
"Bool": true
98+
}
99+
}
100+
},
101+
"stx_burned": 0,
102+
"tx_index": 0,
103+
"txid": "f14dd7dec56405fd7dac69c3080fb569fae4c49c591f9ad0e5cf5c797add9005"
104+
}
105+
],
106+
"tx_merkle_root": "a68e3c76471d9e66b71a14165c4c9a2b980c51efb5b313425cffcef7172d6080",
107+
"valid_merkle_root": true
108+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
type: object
2+
properties:
3+
block_hash:
4+
type: string
5+
description: Hash of the block
6+
pattern: "^[0-9a-f]{64}$"
7+
block_id:
8+
type: string
9+
description: Block ID (index block hash)
10+
pattern: "^[0-9a-f]{64}$"
11+
block_height:
12+
type: integer
13+
description: Height of the Stacks block
14+
format: uint64
15+
consensus_hash:
16+
type: string
17+
description: Consensus hash of the tenure
18+
pattern: "^[0-9a-f]{40}$"
19+
fees:
20+
type: integer
21+
description: total fees for the block
22+
miner_signature:
23+
type: string
24+
description: Uncompressed signature of the miner
25+
pattern: "^[0-9a-f]{130}$"
26+
parent_block_id:
27+
type: string
28+
description: Parent Block ID (index block hash)
29+
pattern: "^[0-9a-f]{64}$"
30+
signer_signature:
31+
type: array
32+
items:
33+
type: string
34+
description: Uncompressed signature of the signer
35+
pattern: "^[0-9a-f]{130}$"
36+
state_index_root:
37+
type: string
38+
pattern: "^[0-9a-f]{64}$"
39+
description: block state index root computed from the MARF (got from the original block)
40+
timestamp:
41+
type: integer
42+
tx_merkle_root:
43+
type: string
44+
description: merkle_root of the included transactions
45+
valid_merkle_root:
46+
type: boolean
47+
description: does the merkle_root matches the chain block and the simulated one?
48+
transactions:
49+
type: array
50+
items:
51+
type: object
52+
properties:
53+
data:
54+
type: object
55+
description: JSON representation of the transaction payload
56+
events:
57+
type: array
58+
items:
59+
type: object
60+
description: JSON representation of the transaction events
61+
execution_cost:
62+
type: object
63+
description: costs accounting for the transaction
64+
hex:
65+
type: string
66+
description: hexadecimal representation of the transaction body
67+
result:
68+
type: object
69+
description: Clarity value representing the transaction result
70+
stx_burned:
71+
type: integer
72+
description: number of burned stx
73+
tx_index:
74+
type: integer
75+
description: index of the transaction in the array of transactions
76+
txid:
77+
type: string
78+
description: transaction id

docs/rpc/openapi.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ components:
159159
$ref: ./components/schemas/get-stacker-set.schema.yaml
160160
TenureBlocks:
161161
$ref: ./components/schemas/tenure-blocks.schema.yaml
162+
BlockReplay:
163+
$ref: ./components/schemas/block-replay.schema.yaml
162164

163165
paths:
164166
/v2/transactions:
@@ -2197,3 +2199,36 @@ paths:
21972199
$ref: "#/components/responses/Unauthorized"
21982200
"500":
21992201
$ref: "#/components/responses/InternalServerError"
2202+
2203+
/v3/blocks/replay/{block_id}:
2204+
get:
2205+
summary: Replay mining of a block and returns its content
2206+
tags:
2207+
- Blocks
2208+
security: []
2209+
operationId: blockReplay
2210+
description: |
2211+
Replay the mining of a block (no data is written in the MARF) and returns its content.
2212+
parameters:
2213+
- name: block_id
2214+
in: path
2215+
description: The block ID hash
2216+
required: true
2217+
schema:
2218+
type: string
2219+
pattern: "^[0-9a-f]{64}$"
2220+
responses:
2221+
"200":
2222+
description: Content of the replayed block
2223+
content:
2224+
application/json:
2225+
schema:
2226+
$ref: "#/components/schemas/BlockReplay"
2227+
example:
2228+
$ref: "./components/examples/block-replay.example.json"
2229+
"400":
2230+
$ref: "#/components/responses/BadRequest"
2231+
"404":
2232+
$ref: "#/components/responses/NotFound"
2233+
"500":
2234+
$ref: "#/components/responses/InternalServerError"

0 commit comments

Comments
 (0)