|
| 1 | +$schema: "https://json-schema.org/draft/2020-12/schema" |
| 2 | +$id: "schema:ethdebug/format/program/context/invoke" |
| 3 | + |
| 4 | +title: ethdebug/format/program/context/invoke |
| 5 | +description: | |
| 6 | + Schema for representing function invocation context at a specific point in |
| 7 | + program execution. |
| 8 | +
|
| 9 | + This context captures information about function calls, including both |
| 10 | + internal function calls (via JUMP) and external contract calls (via CALL, |
| 11 | + DELEGATECALL, STATICCALL, etc.). The schema distinguishes between these |
| 12 | + different invocation types through the use of `internal` and `external` |
| 13 | + boolean properties. |
| 14 | +
|
| 15 | +type: object |
| 16 | +properties: |
| 17 | + invoke: |
| 18 | + type: object |
| 19 | + title: Function invocation |
| 20 | + description: | |
| 21 | + Represents a function invocation, either internal (via JUMP) or external |
| 22 | + (via CALL opcodes). The schema enforces that exactly one of `internal` |
| 23 | + or `external` must be true. |
| 24 | +
|
| 25 | + For internal calls, only `target` and `arguments` are valid. |
| 26 | + For external calls, `gas`, `value`, `input`, `salt`, `delegate`, |
| 27 | + `static`, `create`, and `create2` may be used as appropriate. |
| 28 | +
|
| 29 | + properties: |
| 30 | + target: |
| 31 | + type: object |
| 32 | + title: Invocation target |
| 33 | + description: | |
| 34 | + Pointer to the target of the invocation. For internal calls, this |
| 35 | + typically points to a code location. For external calls, this points |
| 36 | + to the address being called. |
| 37 | + properties: |
| 38 | + pointer: |
| 39 | + $ref: "schema:ethdebug/format/pointer" |
| 40 | + required: |
| 41 | + - pointer |
| 42 | + additionalProperties: false |
| 43 | + |
| 44 | + internal: |
| 45 | + type: boolean |
| 46 | + description: | |
| 47 | + Indicates this is an internal function call (JUMP/JUMPI). |
| 48 | +
|
| 49 | + external: |
| 50 | + type: boolean |
| 51 | + description: | |
| 52 | + Indicates this is an external contract call (CALL/DELEGATECALL/etc). |
| 53 | +
|
| 54 | + arguments: |
| 55 | + type: object |
| 56 | + title: Function arguments |
| 57 | + description: | |
| 58 | + Pointer to the arguments for an internal function call. |
| 59 | + Only valid for internal calls. |
| 60 | + properties: |
| 61 | + pointer: |
| 62 | + $ref: "schema:ethdebug/format/pointer" |
| 63 | + required: |
| 64 | + - pointer |
| 65 | + additionalProperties: false |
| 66 | + |
| 67 | + gas: |
| 68 | + type: object |
| 69 | + title: Gas allocation |
| 70 | + description: | |
| 71 | + Pointer to the gas allocated for an external call. |
| 72 | + Only valid for external calls. |
| 73 | + properties: |
| 74 | + pointer: |
| 75 | + $ref: "schema:ethdebug/format/pointer" |
| 76 | + required: |
| 77 | + - pointer |
| 78 | + additionalProperties: false |
| 79 | + |
| 80 | + value: |
| 81 | + type: object |
| 82 | + title: ETH value |
| 83 | + description: | |
| 84 | + Pointer to the amount of ETH being sent with an external call. |
| 85 | + Only valid for external calls. |
| 86 | + properties: |
| 87 | + pointer: |
| 88 | + $ref: "schema:ethdebug/format/pointer" |
| 89 | + required: |
| 90 | + - pointer |
| 91 | + additionalProperties: false |
| 92 | + |
| 93 | + input: |
| 94 | + type: object |
| 95 | + title: Call input data |
| 96 | + description: | |
| 97 | + Pointer to the input data for an external call. |
| 98 | + Only valid for external calls. |
| 99 | + properties: |
| 100 | + pointer: |
| 101 | + $ref: "schema:ethdebug/format/pointer" |
| 102 | + required: |
| 103 | + - pointer |
| 104 | + additionalProperties: false |
| 105 | + |
| 106 | + salt: |
| 107 | + type: object |
| 108 | + title: CREATE2 salt |
| 109 | + description: | |
| 110 | + Pointer to the salt value for CREATE2. |
| 111 | + Only valid when create2 is true. |
| 112 | + properties: |
| 113 | + pointer: |
| 114 | + $ref: "schema:ethdebug/format/pointer" |
| 115 | + required: |
| 116 | + - pointer |
| 117 | + additionalProperties: false |
| 118 | + |
| 119 | + delegate: |
| 120 | + type: boolean |
| 121 | + description: | |
| 122 | + Indicates this external call is a DELEGATECALL. |
| 123 | + Only valid when external is true. |
| 124 | +
|
| 125 | + static: |
| 126 | + type: boolean |
| 127 | + description: | |
| 128 | + Indicates this external call is a STATICCALL. |
| 129 | + Only valid when external is true. |
| 130 | +
|
| 131 | + create: |
| 132 | + type: boolean |
| 133 | + description: | |
| 134 | + Indicates this external call creates a new contract (CREATE). |
| 135 | + Only valid when external is true. |
| 136 | +
|
| 137 | + create2: |
| 138 | + type: boolean |
| 139 | + description: | |
| 140 | + Indicates this external call creates a new contract (CREATE2). |
| 141 | + Only valid when external is true. |
| 142 | +
|
| 143 | + required: |
| 144 | + - target |
| 145 | + |
| 146 | + oneOf: |
| 147 | + - properties: |
| 148 | + internal: |
| 149 | + const: true |
| 150 | + required: |
| 151 | + - internal |
| 152 | + - properties: |
| 153 | + external: |
| 154 | + const: true |
| 155 | + required: |
| 156 | + - external |
| 157 | + |
| 158 | +required: |
| 159 | + - invoke |
| 160 | + |
| 161 | +additionalProperties: false |
| 162 | + |
| 163 | +examples: |
| 164 | + - invoke: |
| 165 | + target: |
| 166 | + pointer: |
| 167 | + location: code |
| 168 | + offset: 291 |
| 169 | + length: 2 |
| 170 | + internal: true |
| 171 | + arguments: |
| 172 | + pointer: |
| 173 | + location: stack |
| 174 | + slot: 0 |
| 175 | + length: 3 |
| 176 | + |
| 177 | + - invoke: |
| 178 | + target: |
| 179 | + pointer: |
| 180 | + location: stack |
| 181 | + slot: 0 |
| 182 | + external: true |
| 183 | + value: |
| 184 | + pointer: |
| 185 | + location: stack |
| 186 | + slot: 1 |
| 187 | + gas: |
| 188 | + pointer: |
| 189 | + location: stack |
| 190 | + slot: 2 |
| 191 | + input: |
| 192 | + pointer: |
| 193 | + location: memory |
| 194 | + offset: 128 |
| 195 | + length: 68 |
| 196 | + |
| 197 | + - invoke: |
| 198 | + target: |
| 199 | + pointer: |
| 200 | + location: stack |
| 201 | + slot: 0 |
| 202 | + external: true |
| 203 | + delegate: true |
| 204 | + gas: |
| 205 | + pointer: |
| 206 | + location: stack |
| 207 | + slot: 1 |
| 208 | + input: |
| 209 | + pointer: |
| 210 | + location: calldata |
| 211 | + offset: 4 |
| 212 | + length: 68 |
| 213 | + |
| 214 | + - invoke: |
| 215 | + target: |
| 216 | + pointer: |
| 217 | + location: stack |
| 218 | + slot: 0 |
| 219 | + external: true |
| 220 | + create2: true |
| 221 | + salt: |
| 222 | + pointer: |
| 223 | + location: stack |
| 224 | + slot: 1 |
| 225 | + value: |
| 226 | + pointer: |
| 227 | + location: stack |
| 228 | + slot: 2 |
| 229 | + input: |
| 230 | + pointer: |
| 231 | + location: memory |
| 232 | + offset: 0 |
| 233 | + length: 200 |
| 234 | + |
| 235 | + - invoke: |
| 236 | + target: |
| 237 | + pointer: |
| 238 | + location: stack |
| 239 | + slot: 0 |
| 240 | + external: true |
| 241 | + static: true |
| 242 | + gas: |
| 243 | + pointer: |
| 244 | + location: stack |
| 245 | + slot: 1 |
| 246 | + input: |
| 247 | + pointer: |
| 248 | + location: calldata |
| 249 | + offset: 4 |
| 250 | + length: 36 |
0 commit comments