observe_after_step

Schedules a READ at one retained post-step checkpoint.

Example

Local

1
WITH actors AS (
2
SELECT
3
'0x1000000000000000000000000000000000000001'::ADDRESS AS sender,
4
'0x2000000000000000000000000000000000000002'::ADDRESS AS writer
5
),
6
runnable_candidate AS (
7
SELECT
8
'pass'::VARCHAR AS candidate_key,
9
program([execute_call(
10
sender,
11
writer,
12
'0x000000000000000000000000000000000000000000000000000000000000002a'::BYTES,
13
1::UINT256,
14
100000::UBIGINT
15
)]) AS program,
16
[observe_after_step('writer.slot.checkpoint'::VARCHAR, 0::UINTEGER, storage_at(writer, '0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32))] AS observations
17
FROM actors
18
)
19
SELECT
20
candidate_key,
21
len(observations)::INTEGER AS scheduled_observations,
22
observations[1] IS NOT NULL AS scheduled
23
FROM runnable_candidate;
24
-- => [{"candidate_key":"pass","scheduled_observations":1,"scheduled":"true"}]
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

observe_after_step(VARCHAR, UINTEGER, READ) #

Schedules a READ at one retained post-step checkpoint.

Inputs

Name Type Use
observation_key VARCHAR

Required byte-exact UTF-8 key, 1-256 bytes without NUL; keys must be unique within a candidate.

required positional
step_index UINTEGER

Zero-based UINTEGER index of a retained successful post-step checkpoint.

required positional
read READ

Required typed SQL value committed to the authored observation.

required positional

Returns

Name Type
observation OBSERVATION

Typed OBSERVATION authoring value. Returns one canonical typed value. Construction does not execute EVM code, contact RPC, or publish evidence.

Guidance

Behavior and consumption

Authors one typed value for later PROGRAM assembly or run consumption; it does not execute or publish.

Validation and failure timing

SQL types bind first; widths, ABI selection, duplicates, empty programs, and selectors validate when the constructor executes.

Determinism, network, and side effects

Construction is deterministic and offline: no RPC, chain mutation, or evidence write.

Use and do not use

Use it to author PROGRAM input, not as proof of execution or future success.

Related functions

Category and tags

Category
Simulation
Tag
Simulate