program

Builds a sequential, non-atomic EVM PROGRAM from typed assumptions and call steps.

Example

Local

1
WITH actors AS (
2
SELECT
3
'0x1000000000000000000000000000000000000001'::ADDRESS AS sender,
4
'0x2000000000000000000000000000000000000002'::ADDRESS AS writer,
5
'0x3000000000000000000000000000000000000003'::ADDRESS AS second_target
6
),
7
step_values AS (
8
SELECT [
9
execute_call(
10
sender,
11
writer,
12
'0x000000000000000000000000000000000000000000000000000000000000002a'::BYTES,
13
1::UINT256,
14
100000::UBIGINT
15
),
16
execute_contract(
17
sender,
18
second_target,
19
0::UINT256,
20
100000::UBIGINT,
21
'[{"type":"function","name":"set","inputs":[{"name":"value","type":"uint256"}],"outputs":[]}]'::JSON,
22
'set'::VARCHAR,
23
7::UINT256
24
)
25
] AS steps
26
FROM actors
27
),
28
authored AS (
29
SELECT steps, program(steps) AS program
30
FROM step_values
31
)
32
SELECT
33
len(steps)::INTEGER AS step_count,
34
'raw,abi'::VARCHAR AS step_order,
35
program IS NOT NULL AS runnable
36
FROM authored;
37
-- => [{"step_count":2,"step_order":"raw,abi","runnable":"true"}]
Notebook ready in readonly mode.

API reference

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

program(STEP[]) #

Builds a sequential, non-atomic EVM PROGRAM from typed assumptions and call steps.

Inputs

Name Type Use
steps STEP[]

Required typed SQL value committed to the authored program.

required positional

Returns

Name Type
program PROGRAM

Typed PROGRAM 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.

Additional overloads

program(ASSUMPTION[], STEP[]) #

Builds a sequential, non-atomic EVM PROGRAM from typed assumptions and call steps.

Inputs

Name Type Use
assumptions ASSUMPTION[]

Required typed SQL value committed to the authored program.

required positional
steps STEP[]

Required typed SQL value committed to the authored program.

required positional

Returns

Name Type
program PROGRAM

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

Examples

Local SQL

1
WITH actors AS (
2
SELECT
3
'0x1000000000000000000000000000000000000001'::ADDRESS AS sender,
4
'0x2000000000000000000000000000000000000002'::ADDRESS AS writer
5
),
6
inputs AS (
7
SELECT
8
[
9
-- Funds the value consumed by the step.
10
assume_native_balance(sender, 1000000::UINT256, 'funds step value transfer'::VARCHAR),
11
assume_nonce(sender, 0::UBIGINT, 'step sender nonce'::VARCHAR),
12
assume_no_code(sender, 'step sender is an EOA'::VARCHAR),
13
assume_native_balance(writer, 0::UINT256, 'receives step value'::VARCHAR),
14
assume_nonce(writer, 0::UBIGINT, 'call target nonce'::VARCHAR),
15
-- The step consumes this runtime and initial slot.
16
assume_code(writer, '0x60003560005500'::BYTES, 'step code stores calldata word'::VARCHAR),
17
assume_storage(
18
writer,
19
'0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32,
20
'0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32,
21
'step writes slot zero'::VARCHAR
22
)
23
] AS assumptions,
24
[execute_call(
25
sender,
26
writer,
27
'0x000000000000000000000000000000000000000000000000000000000000002a'::BYTES,
28
1::UINT256,
29
100000::UBIGINT
30
)] AS steps
31
FROM actors
32
),
33
authored AS (
34
SELECT assumptions, steps, program(assumptions, steps) AS program
35
FROM inputs
36
)
37
SELECT
38
len(assumptions)::INTEGER AS assumption_count,
39
len(steps)::INTEGER AS step_count,
40
program IS NOT NULL AS runnable
41
FROM authored;
42
-- => [{"assumption_count":7,"step_count":1,"runnable":"true"}]
Notebook ready in readonly mode.

Related functions

Category and tags

Category
Simulation
Tag
Simulate