Request validation
Key length, NUL bytes, and duplicate points are validated when the observation list is consumed. A request may contain at most 256 expanded points across all OBSERVATION values.
Schedules one keyed READ at both the pre and terminal execution checkpoints.
Runs locally
-- Schedule a storage observation on a runnable candidate
WITH actors AS (
SELECT
'0x1000000000000000000000000000000000000001'::ADDRESS AS sender,
'0x2000000000000000000000000000000000000002'::ADDRESS AS writer
),
runnable_candidate AS (
SELECT
'pass'::VARCHAR AS candidate_key,
program([execute_call(
sender,
writer,
'0x000000000000000000000000000000000000000000000000000000000000002a'::BYTES,
1::UINT256,
100000::UBIGINT
)]) AS program,
[observe('writer.slot.checkpoint'::VARCHAR, storage_at(writer, '0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32))] AS observations
FROM actors
)
SELECT
candidate_key,
len(observations)::INTEGER AS scheduled_observations,
observations[1] IS NOT NULL AS scheduled
FROM runnable_candidate;
-- => [{"candidate_key":"pass","scheduled_observations":1,"scheduled":"true"}]observe(VARCHAR, READ) # Schedules one keyed READ at both the pre and terminal execution checkpoints.
| Name | Type | Use |
|---|---|---|
observation_key | VARCHAR Non-NULL valid UTF-8 key; the consumed request requires 1-256 bytes and no NUL byte. | required positional |
read | READ Non-NULL READ evaluated once before step zero and once at terminal state. | required positional |
| Name | Type |
|---|---|
observation | OBSERVATION |
Pre-and-terminal OBSERVATION. Returns one OBSERVATION that expands to two points, pre and terminal, when execution requests are compiled.
observe(VARCHAR, READ, VARCHAR) # Schedules one keyed READ at exactly the pre or terminal execution checkpoint.
| Name | Type | Use |
|---|---|---|
observation_key | VARCHAR Non-NULL valid UTF-8 key; the consumed request requires 1-256 bytes and no NUL byte. | required positional |
read | READ Non-NULL READ evaluated at the selected checkpoint. | required positional |
checkpoint | VARCHAR Case-insensitive selector; only pre or terminal is accepted. | required positional |
| Name | Type |
|---|---|
observation | OBSERVATION |
Single-checkpoint OBSERVATION. Returns one OBSERVATION that expands to the selected pre or terminal point.
Key length, NUL bytes, and duplicate points are validated when the observation list is consumed. A request may contain at most 256 expanded points across all OBSERVATION values.
Runs locally
-- Schedule a storage observation on a runnable candidate
WITH actors AS (
SELECT
'0x1000000000000000000000000000000000000001'::ADDRESS AS sender,
'0x2000000000000000000000000000000000000002'::ADDRESS AS writer
),
runnable_candidate AS (
SELECT
'pass'::VARCHAR AS candidate_key,
program([execute_call(
sender,
writer,
'0x000000000000000000000000000000000000000000000000000000000000002a'::BYTES,
1::UINT256,
100000::UBIGINT
)]) AS program,
[observe('writer.slot.checkpoint'::VARCHAR, storage_at(writer, '0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32), 'pre'::VARCHAR)] AS observations
FROM actors
)
SELECT
candidate_key,
len(observations)::INTEGER AS scheduled_observations,
observations[1] IS NOT NULL AS scheduled
FROM runnable_candidate;
-- => [{"candidate_key":"pass","scheduled_observations":1,"scheduled":"true"}]