View this page as Markdown

call_context

Builds the EVM transaction context attached to one PROGRAM call step.

Example

Local

WITH actors AS (
  SELECT
    '0x1000000000000000000000000000000000000001'::ADDRESS AS sender,
    '0x2000000000000000000000000000000000000002'::ADDRESS AS writer
),
authored AS (
  SELECT
    access_list,
    context,
    execute_call(
      sender,
      writer,
      '0x000000000000000000000000000000000000000000000000000000000000002a'::BYTES,
      1::UINT256,
      100000::UBIGINT,
      context
    ) AS step
  FROM (
    SELECT
      *,
      call_context(
        1::UINT256,
        access_list,
        []::BYTES32[]
      ) AS context
    FROM (
      SELECT
        *,
        [{
          address: writer,
          storage_keys: [
            '0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32
          ]
        }] AS access_list
      FROM actors
    )
  )
)
SELECT
  len(access_list)::INTEGER AS warmed_accounts,
  step IS NOT NULL AS contextual_step
FROM authored;
-- => [{"warmed_accounts":1,"contextual_step":"true"}]

API reference

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

call_context(UINT256, STRUCT(address ADDRESS, storage_keys BYTES32[])[], BYTES32[]) #

Builds the EVM transaction context attached to one PROGRAM call step.

Inputs

Name Type Use
gas_price UINT256

Exact UINT256 gas price, in Wei per gas, exposed to EVM execution.

required positional
access_list STRUCT(address ADDRESS, storage_keys BYTES32[])[]

Non-NULL list of non-NULL address entries; each storage_keys field and each BYTES32 key must be non-NULL.

required positional
blob_versioned_hashes BYTES32[]

Non-NULL list of non-NULL BYTES32 hashes exposed to EVM execution.

required positional

Returns

Name Type
context CALL_CONTEXT

CALL_CONTEXT value. Returns a CALL_CONTEXT that can be attached to a raw or ABI PROGRAM step; it does not execute the step.

Guidance

Defaults

A step without CALL_CONTEXT uses a zero gas price and empty access-list and blob-hash lists.

Related functions

Category and tags

Category
Simulation
Tag
Simulate