Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/format/src/types/program/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,17 @@ export namespace Context {
Invoke.isInvocation(value.invoke);

export namespace Invoke {
export type Invocation = Function.Identity &
(
export type Invocation = Function.Identity & {
activation?: string;
} & (
| Invocation.InternalCall
| Invocation.ExternalCall
| Invocation.ContractCreation
);

export const isInvocation = (value: unknown): value is Invocation =>
Function.isIdentity(value) &&
(!("activation" in value) || typeof value.activation === "string") &&
(Invocation.isInternalCall(value) ||
Invocation.isExternalCall(value) ||
Invocation.isContractCreation(value));
Expand Down Expand Up @@ -241,14 +243,16 @@ export namespace Context {
export interface Info extends Function.Identity {
data?: Function.PointerRef;
success?: Function.PointerRef;
activation?: string;
}

export const isInfo = (value: unknown): value is Info =>
Function.isIdentity(value) &&
typeof value === "object" &&
!!value &&
(!("data" in value) || Function.isPointerRef(value.data)) &&
(!("success" in value) || Function.isPointerRef(value.success));
(!("success" in value) || Function.isPointerRef(value.success)) &&
(!("activation" in value) || typeof value.activation === "string");
}

export interface Revert {
Expand All @@ -265,13 +269,15 @@ export namespace Context {
export interface Info extends Function.Identity {
reason?: Function.PointerRef;
panic?: number;
activation?: string;
}

export const isInfo = (value: unknown): value is Info =>
Function.isIdentity(value) &&
typeof value === "object" &&
!!value &&
(!("reason" in value) || Function.isPointerRef(value.reason)) &&
(!("panic" in value) || typeof value.panic === "number");
(!("panic" in value) || typeof value.panic === "number") &&
(!("activation" in value) || typeof value.activation === "string");
}
}
15 changes: 15 additions & 0 deletions schemas/program/context/function/invoke.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ properties:

$ref: "schema:ethdebug/format/program/context/function"

properties:
activation:
type: string
title: Activation identifier
description: |
Correlation identifier pairing this invocation with its
matching return or revert. The invoke that opens an
activation and the return or revert that closes it carry
the same value; distinct activations carry distinct
values, unique within the program. Lets a debugger pair a
call with its return independent of trace order. Optional.

allOf:
- oneOf:
- required: [jump]
Expand Down Expand Up @@ -283,6 +295,9 @@ examples:
- name: "amount"
location: stack
slot: 2
# The matching return context carries the same `activation`
# value, pairing this call with its return.
activation: "transfer#0"

# -----------------------------------------------------------
# External CALL: token.balanceOf(account)
Expand Down
14 changes: 14 additions & 0 deletions schemas/program/context/function/return.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ properties:
required:
- pointer

activation:
type: string
title: Activation identifier
description: |
Correlation identifier for the activation this return
ends. Matches the `activation` on the `invoke` that
opened the same activation; distinct activations carry
distinct values, unique within the program. Lets a
debugger pair a return with its invocation independent
of trace order. Optional.

unevaluatedProperties: false

required:
Expand All @@ -75,6 +86,9 @@ examples:
pointer:
location: stack
slot: 0
# Same `activation` value as the opening `invoke`, pairing
# this return with its call.
activation: "transfer#0"

# -----------------------------------------------------------
# External call return: processing result of a CALL
Expand Down
11 changes: 11 additions & 0 deletions schemas/program/context/function/revert.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ properties:
(e.g., Solidity uses codes like 0x11 for arithmetic
overflow).

activation:
type: string
title: Activation identifier
description: |
Correlation identifier for the activation this revert
ends. Matches the `activation` on the `invoke` that
opened the same activation; distinct activations carry
distinct values, unique within the program. Lets a
debugger pair an abnormal exit with its invocation
independent of trace order. Optional.

unevaluatedProperties: false

required:
Expand Down
Loading