Invocation contexts
- Explore
- View source
- Playground
Loading ....
- YAML
- JSON
ethdebug/format/program/context/function/invoke
$schema: "https://json-schema.org/draft/2020-12/schema"
$id: "schema:ethdebug/format/program/context/function/invoke"
title: ethdebug/format/program/context/function/invoke
description: |
This context indicates that the marked instruction is
associated with a function invocation. The invocation is one
of three kinds: an internal call via JUMP, an external message
call (CALL / DELEGATECALL / STATICCALL), or a contract
creation (CREATE / CREATE2).
Extends the function identity schema with kind-specific fields
such as call targets, gas, value, and input data.
type: object
properties:
invoke:
type: object
title: Function invocation
description: |
Describes the function invocation associated with this
context. Must indicate exactly one invocation kind: `jump`
for an internal call, `message` for an external call, or
`create` for a contract creation.
$ref: "schema:ethdebug/format/program/context/function"
allOf:
- oneOf:
- required: [jump]
- required: [message]
- required: [create]
- if:
required: [jump]
then:
$ref: "#/$defs/InternalCall"
- if:
required: [message]
then:
$ref: "#/$defs/ExternalCall"
- if:
required: [create]
then:
$ref: "#/$defs/ContractCreation"
unevaluatedProperties: false
required:
- invoke
$defs:
InternalCall:
title: Internal call
description: |
An internal function call within the same contract, entered
via JUMP/JUMPI.
type: object
properties:
jump:
description: |
Indicates this is an internal function call (JUMP/JUMPI).
const: true
target:
type: object
title: Invocation target
description: |
Pointer to the target of the invocation. For internal
calls, this typically points to a code location.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
arguments:
type: object
title: Function arguments
description: |
Pointer to the arguments for an internal function call.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
required: [jump, target]
ExternalCall:
title: External call
description: |
An external message call to another contract via CALL,
DELEGATECALL, or STATICCALL. Set `delegate` or `static` to
`true` to indicate the call variant; if neither is present
the call is a regular CALL.
type: object
properties:
message:
description: |
Indicates this is an external message call (CALL,
DELEGATECALL, or STATICCALL).
const: true
target:
type: object
title: Invocation target
description: |
Pointer to the target of the invocation. For external
calls, this points to the address and/or selector
being called.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
gas:
type: object
title: Gas allocation
description: |
Pointer to the gas allocated for the external call.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
value:
type: object
title: ETH value
description: |
Pointer to the amount of ETH being sent with the call.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
input:
type: object
title: Call input data
description: |
Pointer to the input data for the external call.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
delegate:
description: |
Indicates this external call is a DELEGATECALL.
const: true
static:
description: |
Indicates this external call is a STATICCALL.
const: true
not:
description: Only one of `delegate` and `static` can be set at a time.
required: [delegate, static]
required: [message, target]
ContractCreation:
title: Contract creation
description: |
A contract creation via CREATE or CREATE2. The presence
of `salt` distinguishes CREATE2 from CREATE.
type: object
properties:
create:
description: |
Indicates this is a contract creation operation
(CREATE or CREATE2).
const: true
value:
type: object
title: ETH value
description: |
Pointer to the amount of ETH being sent with the
creation.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
salt:
type: object
title: CREATE2 salt
description: |
Pointer to the salt value for CREATE2. Its presence
implies this is a CREATE2 operation.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
input:
type: object
title: Creation bytecode
description: |
Pointer to the creation bytecode for the new contract.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
required: [create]
examples:
# -----------------------------------------------------------
# Internal call: transfer(address, uint256)
# -----------------------------------------------------------
# This context would mark the JUMP instruction that enters
# the function. Before the jump, the compiler has arranged
# the stack as follows (top first):
#
# slot 0: jump destination (entry PC of `transfer`)
# slot 1: return label
# slot 2: first argument (`to`)
# slot 3: second argument (`amount`)
#
# The `target` pointer reads the jump destination from the
# stack; `arguments` uses a group to name each argument's
# stack position.
- invoke:
identifier: "transfer"
declaration:
source:
id: 0
range:
offset: 128
length: 95
type:
id: 7
jump: true
target:
pointer:
location: stack
slot: 0
arguments:
pointer:
group:
- name: "to"
location: stack
slot: 2
- name: "amount"
location: stack
slot: 3
# -----------------------------------------------------------
# External CALL: token.balanceOf(account)
# -----------------------------------------------------------
# This context would mark the CALL instruction. The EVM
# expects the stack to contain (top first):
#
# slot 0: gas to forward
# slot 1: target contract address
# slot 2: value (0 — balanceOf is non-payable)
#
# The ABI-encoded calldata has already been written to
# memory at 0x80:
#
# 0x80..0x83: function selector (4 bytes)
# 0x84..0xa3: abi-encoded `account` (32 bytes)
- invoke:
identifier: "balanceOf"
message: true
target:
pointer:
location: stack
slot: 1
gas:
pointer:
location: stack
slot: 0
value:
pointer:
location: stack
slot: 2
input:
pointer:
group:
- name: "selector"
location: memory
offset: "0x80"
length: 4
- name: "arguments"
location: memory
offset: "0x84"
length: "0x20"
# -----------------------------------------------------------
# DELEGATECALL: proxy forwarding calldata
# -----------------------------------------------------------
# This context would mark a DELEGATECALL instruction in a
# proxy contract. The call executes the implementation's
# code within the proxy's storage context.
#
# DELEGATECALL takes no value parameter. Stack layout
# (top first):
#
# slot 0: gas
# slot 1: implementation address
#
# The original calldata has been copied into memory:
#
# 0x80..0xe3: forwarded calldata (100 bytes)
- invoke:
message: true
delegate: true
target:
pointer:
location: stack
slot: 1
gas:
pointer:
location: stack
slot: 0
input:
pointer:
location: memory
offset: "0x80"
length: "0x64"
# -----------------------------------------------------------
# CREATE2: deploying a child contract
# -----------------------------------------------------------
# This context would mark the CREATE2 instruction. Stack
# layout (top first):
#
# slot 0: value (ETH to send to the new contract)
# slot 1: salt (for deterministic address derivation)
#
# The init code has been placed in memory:
#
# 0x80..0x027f: creation bytecode (512 bytes)
- invoke:
create: true
value:
pointer:
location: stack
slot: 0
salt:
pointer:
location: stack
slot: 1
input:
pointer:
location: memory
offset: "0x80"
length: "0x200"
ethdebug/format/program/context/function/invoke
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema:ethdebug/format/program/context/function/invoke",
"title": "ethdebug/format/program/context/function/invoke",
"description": "This context indicates that the marked instruction is\nassociated with a function invocation. The invocation is one\nof three kinds: an internal call via JUMP, an external message\ncall (CALL / DELEGATECALL / STATICCALL), or a contract\ncreation (CREATE / CREATE2).\n\nExtends the function identity schema with kind-specific fields\nsuch as call targets, gas, value, and input data.\n",
"type": "object",
"properties": {
"invoke": {
"type": "object",
"title": "Function invocation",
"description": "Describes the function invocation associated with this\ncontext. Must indicate exactly one invocation kind: `jump`\nfor an internal call, `message` for an external call, or\n`create` for a contract creation.\n",
"$ref": "schema:ethdebug/format/program/context/function",
"allOf": [
{
"oneOf": [
{
"required": [
"jump"
]
},
{
"required": [
"message"
]
},
{
"required": [
"create"
]
}
]
},
{
"if": {
"required": [
"jump"
]
},
"then": {
"$ref": "#/$defs/InternalCall"
}
},
{
"if": {
"required": [
"message"
]
},
"then": {
"$ref": "#/$defs/ExternalCall"
}
},
{
"if": {
"required": [
"create"
]
},
"then": {
"$ref": "#/$defs/ContractCreation"
}
}
],
"unevaluatedProperties": false
}
},
"required": [
"invoke"
],
"$defs": {
"InternalCall": {
"title": "Internal call",
"description": "An internal function call within the same contract, entered\nvia JUMP/JUMPI.\n",
"type": "object",
"properties": {
"jump": {
"description": "Indicates this is an internal function call (JUMP/JUMPI).\n",
"const": true
},
"target": {
"type": "object",
"title": "Invocation target",
"description": "Pointer to the target of the invocation. For internal\ncalls, this typically points to a code location.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"arguments": {
"type": "object",
"title": "Function arguments",
"description": "Pointer to the arguments for an internal function call.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
}
},
"required": [
"jump",
"target"
]
},
"ExternalCall": {
"title": "External call",
"description": "An external message call to another contract via CALL,\nDELEGATECALL, or STATICCALL. Set `delegate` or `static` to\n`true` to indicate the call variant; if neither is present\nthe call is a regular CALL.\n",
"type": "object",
"properties": {
"message": {
"description": "Indicates this is an external message call (CALL,\nDELEGATECALL, or STATICCALL).\n",
"const": true
},
"target": {
"type": "object",
"title": "Invocation target",
"description": "Pointer to the target of the invocation. For external\ncalls, this points to the address and/or selector\nbeing called.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"gas": {
"type": "object",
"title": "Gas allocation",
"description": "Pointer to the gas allocated for the external call.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"value": {
"type": "object",
"title": "ETH value",
"description": "Pointer to the amount of ETH being sent with the call.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"input": {
"type": "object",
"title": "Call input data",
"description": "Pointer to the input data for the external call.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"delegate": {
"description": "Indicates this external call is a DELEGATECALL.\n",
"const": true
},
"static": {
"description": "Indicates this external call is a STATICCALL.\n",
"const": true
}
},
"not": {
"description": "Only one of `delegate` and `static` can be set at a time.",
"required": [
"delegate",
"static"
]
},
"required": [
"message",
"target"
]
},
"ContractCreation": {
"title": "Contract creation",
"description": "A contract creation via CREATE or CREATE2. The presence\nof `salt` distinguishes CREATE2 from CREATE.\n",
"type": "object",
"properties": {
"create": {
"description": "Indicates this is a contract creation operation\n(CREATE or CREATE2).\n",
"const": true
},
"value": {
"type": "object",
"title": "ETH value",
"description": "Pointer to the amount of ETH being sent with the\ncreation.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"salt": {
"type": "object",
"title": "CREATE2 salt",
"description": "Pointer to the salt value for CREATE2. Its presence\nimplies this is a CREATE2 operation.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"input": {
"type": "object",
"title": "Creation bytecode",
"description": "Pointer to the creation bytecode for the new contract.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
}
},
"required": [
"create"
]
}
},
"examples": [
{
"invoke": {
"identifier": "transfer",
"declaration": {
"source": {
"id": 0
},
"range": {
"offset": 128,
"length": 95
}
},
"type": {
"id": 7
},
"jump": true,
"target": {
"pointer": {
"location": "stack",
"slot": 0
}
},
"arguments": {
"pointer": {
"group": [
{
"name": "to",
"location": "stack",
"slot": 2
},
{
"name": "amount",
"location": "stack",
"slot": 3
}
]
}
}
}
},
{
"invoke": {
"identifier": "balanceOf",
"message": true,
"target": {
"pointer": {
"location": "stack",
"slot": 1
}
},
"gas": {
"pointer": {
"location": "stack",
"slot": 0
}
},
"value": {
"pointer": {
"location": "stack",
"slot": 2
}
},
"input": {
"pointer": {
"group": [
{
"name": "selector",
"location": "memory",
"offset": "0x80",
"length": 4
},
{
"name": "arguments",
"location": "memory",
"offset": "0x84",
"length": "0x20"
}
]
}
}
}
},
{
"invoke": {
"message": true,
"delegate": true,
"target": {
"pointer": {
"location": "stack",
"slot": 1
}
},
"gas": {
"pointer": {
"location": "stack",
"slot": 0
}
},
"input": {
"pointer": {
"location": "memory",
"offset": "0x80",
"length": "0x64"
}
}
}
},
{
"invoke": {
"create": true,
"value": {
"pointer": {
"location": "stack",
"slot": 0
}
},
"salt": {
"pointer": {
"location": "stack",
"slot": 1
}
},
"input": {
"pointer": {
"location": "memory",
"offset": "0x80",
"length": "0x200"
}
}
}
}
]
}
Loading playground...
Internal call
An internal call represents a function call within the same contract via JUMP/JUMPI. The target points to a code location and arguments are passed on the stack.
- Explore
- View source
- Playground
Loading ....
- YAML
- JSON
ethdebug/format/program/context/function/invoke#/$defs/InternalCall
title: Internal call
description: |
An internal function call within the same contract, entered
via JUMP/JUMPI.
type: object
properties:
jump:
description: |
Indicates this is an internal function call (JUMP/JUMPI).
const: true
target:
type: object
title: Invocation target
description: |
Pointer to the target of the invocation. For internal
calls, this typically points to a code location.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
arguments:
type: object
title: Function arguments
description: |
Pointer to the arguments for an internal function call.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
required: [ jump, target ]
ethdebug/format/program/context/function/invoke#/$defs/InternalCall
{
"title": "Internal call",
"description": "An internal function call within the same contract, entered\nvia JUMP/JUMPI.\n",
"type": "object",
"properties": {
"jump": {
"description": "Indicates this is an internal function call (JUMP/JUMPI).\n",
"const": true
},
"target": {
"type": "object",
"title": "Invocation target",
"description": "Pointer to the target of the invocation. For internal\ncalls, this typically points to a code location.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"arguments": {
"type": "object",
"title": "Function arguments",
"description": "Pointer to the arguments for an internal function call.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
}
},
"required": [
"jump",
"target"
]
}
Loading playground...
External call
An external call represents a call to another contract via CALL,
DELEGATECALL, or STATICCALL. The type of call may be indicated by
setting delegate or static to true. If neither flag is present,
the invocation represents a regular CALL.
- Explore
- View source
- Playground
Loading ....
- YAML
- JSON
ethdebug/format/program/context/function/invoke#/$defs/ExternalCall
title: External call
description: |
An external message call to another contract via CALL,
DELEGATECALL, or STATICCALL. Set `delegate` or `static` to
`true` to indicate the call variant; if neither is present
the call is a regular CALL.
type: object
properties:
message:
description: |
Indicates this is an external message call (CALL,
DELEGATECALL, or STATICCALL).
const: true
target:
type: object
title: Invocation target
description: |
Pointer to the target of the invocation. For external
calls, this points to the address and/or selector
being called.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
gas:
type: object
title: Gas allocation
description: |
Pointer to the gas allocated for the external call.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
value:
type: object
title: ETH value
description: |
Pointer to the amount of ETH being sent with the call.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
input:
type: object
title: Call input data
description: |
Pointer to the input data for the external call.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
delegate:
description: |
Indicates this external call is a DELEGATECALL.
const: true
static:
description: |
Indicates this external call is a STATICCALL.
const: true
not:
description: Only one of `delegate` and `static` can be set at a time.
required: [ delegate, static ]
required: [ message, target ]
ethdebug/format/program/context/function/invoke#/$defs/ExternalCall
{
"title": "External call",
"description": "An external message call to another contract via CALL,\nDELEGATECALL, or STATICCALL. Set `delegate` or `static` to\n`true` to indicate the call variant; if neither is present\nthe call is a regular CALL.\n",
"type": "object",
"properties": {
"message": {
"description": "Indicates this is an external message call (CALL,\nDELEGATECALL, or STATICCALL).\n",
"const": true
},
"target": {
"type": "object",
"title": "Invocation target",
"description": "Pointer to the target of the invocation. For external\ncalls, this points to the address and/or selector\nbeing called.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"gas": {
"type": "object",
"title": "Gas allocation",
"description": "Pointer to the gas allocated for the external call.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"value": {
"type": "object",
"title": "ETH value",
"description": "Pointer to the amount of ETH being sent with the call.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"input": {
"type": "object",
"title": "Call input data",
"description": "Pointer to the input data for the external call.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"delegate": {
"description": "Indicates this external call is a DELEGATECALL.\n",
"const": true
},
"static": {
"description": "Indicates this external call is a STATICCALL.\n",
"const": true
}
},
"not": {
"description": "Only one of `delegate` and `static` can be set at a time.",
"required": [
"delegate",
"static"
]
},
"required": [
"message",
"target"
]
}
Loading playground...
Contract creation
A contract creation represents a CREATE or CREATE2 operation. The
presence of salt implies CREATE2.
- Explore
- View source
- Playground
Loading ....
- YAML
- JSON
ethdebug/format/program/context/function/invoke#/$defs/ContractCreation
title: Contract creation
description: |
A contract creation via CREATE or CREATE2. The presence
of `salt` distinguishes CREATE2 from CREATE.
type: object
properties:
create:
description: |
Indicates this is a contract creation operation
(CREATE or CREATE2).
const: true
value:
type: object
title: ETH value
description: |
Pointer to the amount of ETH being sent with the
creation.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
salt:
type: object
title: CREATE2 salt
description: |
Pointer to the salt value for CREATE2. Its presence
implies this is a CREATE2 operation.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
input:
type: object
title: Creation bytecode
description: |
Pointer to the creation bytecode for the new contract.
properties:
pointer:
$ref: "schema:ethdebug/format/pointer"
required:
- pointer
additionalProperties: false
required: [ create ]
ethdebug/format/program/context/function/invoke#/$defs/ContractCreation
{
"title": "Contract creation",
"description": "A contract creation via CREATE or CREATE2. The presence\nof `salt` distinguishes CREATE2 from CREATE.\n",
"type": "object",
"properties": {
"create": {
"description": "Indicates this is a contract creation operation\n(CREATE or CREATE2).\n",
"const": true
},
"value": {
"type": "object",
"title": "ETH value",
"description": "Pointer to the amount of ETH being sent with the\ncreation.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"salt": {
"type": "object",
"title": "CREATE2 salt",
"description": "Pointer to the salt value for CREATE2. Its presence\nimplies this is a CREATE2 operation.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
},
"input": {
"type": "object",
"title": "Creation bytecode",
"description": "Pointer to the creation bytecode for the new contract.\n",
"properties": {
"pointer": {
"$ref": "schema:ethdebug/format/pointer"
}
},
"required": [
"pointer"
],
"additionalProperties": false
}
},
"required": [
"create"
]
}
Loading playground...