Skip to content
Merged
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
1 change: 1 addition & 0 deletions packages/web/spec/data/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ These schemas (like all schemas in this format) are specified as
Please refer to the following resources in this section, or see the navigation
bar for complete contents.

- [Non-negative numeric values](/spec/data/value)
- [Hexadecimal strings](/spec/data/hex)
- [Unsigned integer](/spec/data/unsigned)
11 changes: 11 additions & 0 deletions packages/web/spec/data/value.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
sidebar_position: 2
---

import SchemaViewer from "@site/src/components/SchemaViewer";

# Non-negative numeric values

<SchemaViewer
schema={{ id: "schema:ethdebug/format/data/value" }}
/>
2 changes: 1 addition & 1 deletion packages/web/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const pointerSchemaIndex: SchemaIndex = {
})).reduce((a, b) => ({ ...a, ...b }), {}),
};

const dataSchemaIndex: SchemaIndex = ["hex", "unsigned"].map(name => ({
const dataSchemaIndex: SchemaIndex = ["value", "hex", "unsigned"].map(name => ({
[`schema:ethdebug/format/data/${name}`]: {
href: `/spec/data/${name}`
}
Expand Down
20 changes: 20 additions & 0 deletions schemas/data/value.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$schema: "https://json-schema.org/draft/2020-12/schema"
$id: "schema:ethdebug/format/data/value"

title: ethdebug/format/data/value
description: |
A non-negative integer value, expressed either as a native JSON number or as
a `0x`-prefixed hexadecimal string.

oneOf:
- description: A non-negative integer literal
$ref: "schema:ethdebug/format/data/unsigned"

- description: |
A `0x`-prefixed hexadecimal string representing literal bytes or a number
commonly displayed in base 16 (e.g. bytecode instruction offsets).
$ref: "schema:ethdebug/format/data/hex"

examples:
- "0x0000"
- 2
4 changes: 2 additions & 2 deletions schemas/materials/source-range.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ properties:
offset:
description: |
Byte offset at beginning of range.
$ref: "schema:ethdebug/format/data/unsigned"
$ref: "schema:ethdebug/format/data/value"

length:
description: Number of bytes contained in range
$ref: "schema:ethdebug/format/data/unsigned"
$ref: "schema:ethdebug/format/data/value"

unevaluatedProperties: false

Expand Down
8 changes: 1 addition & 7 deletions schemas/pointer/expression.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ $defs:
description: |
An unsigned number or a `0x`-prefixed string of hexadecimal digits

oneOf:
- description: A non-negative integer literal
$ref: "schema:ethdebug/format/data/unsigned"

- description: |
A `0x`-prefixed hexadecimal string representing literal bytes
$ref: "schema:ethdebug/format/data/hex"
$ref: "schema:ethdebug/format/data/value"

examples:
- 5
Expand Down
10 changes: 4 additions & 6 deletions schemas/program/instruction.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ properties:
instruction's program counter. For EOF bytecode, this value **must** be
the offset from the start of the container, not the start of a particular
code section within that container.
oneOf:
- $ref: "schema:ethdebug/format/data/unsigned"
- $ref: "schema:ethdebug/format/data/hex"
$ref: "schema:ethdebug/format/data/value"

operation:
title: Machine operation information
Expand All @@ -36,9 +34,9 @@ properties:
minItems: 1
items:
description: |
An immediate value, specified as a `0x`-prefixed hexadecimal string.
type: string
pattern: "^0x[0-9a-fA-F]{1,}$"
An immediate value specified as argument to the opcode
$ref: "schema:ethdebug/format/data/value"

required:
- mnemonic

Expand Down