diff --git a/CHANGELOG.md b/CHANGELOG.md index 519bf11bde..07a07cdf22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,14 @@ The sections do not signal obligations; the prefixes do. ### Changed +- The `places` of a `fixed` or `ufixed` type may now be 0, as Solidity + allows. The minimum was 1 ([#420]). + - Schemas: **ethdebug/format/type/elementary/fixed**, + **ethdebug/format/type/elementary/ufixed** + - Producers: optional: a `fixed` or `ufixed` type may have `places: 0`. + - Consumers: required: the `minimum` of `places` is now 0. A consumer must + accept `places: 0`, which means the raw value is read unscaled. + - The members of a `define` no longer depend on their order, since JSON objects are unordered. A member may use any other member of the same `define`. Inside its own expression, its own name means the variable of the @@ -763,3 +771,4 @@ First published version of the specification. [#402]: https://github.com/ethdebug/format/pull/402 [#404]: https://github.com/ethdebug/format/pull/404 [#408]: https://github.com/ethdebug/format/pull/408 +[#420]: https://github.com/ethdebug/format/pull/420 diff --git a/packages/format/CHANGELOG.md b/packages/format/CHANGELOG.md index 58918d31d2..a9bd8d0eb1 100644 --- a/packages/format/CHANGELOG.md +++ b/packages/format/CHANGELOG.md @@ -12,6 +12,8 @@ tracked in the root [`CHANGELOG.md`](../../CHANGELOG.md). module load, and the package declares `"sideEffects": false`. A bundle that imports only the types and guards no longer includes the `yaml` library or the schema sources. The API is unchanged ([#373]). +- `Type.Elementary.isFixed` and `Type.Elementary.isUfixed` accept + `places: 0`. See the root [`CHANGELOG.md`](../../CHANGELOG.md) ([#420]). ## 0.1.0-draft.2 — 2026-10-07 @@ -156,6 +158,7 @@ First publication. [#323]: https://github.com/ethdebug/format/pull/323 [#325]: https://github.com/ethdebug/format/pull/325 [#373]: https://github.com/ethdebug/format/pull/373 +[#420]: https://github.com/ethdebug/format/pull/420 [`0ef2f37`]: https://github.com/ethdebug/format/commit/0ef2f37 [`10ab103`]: https://github.com/ethdebug/format/commit/10ab103 [`21e532e`]: https://github.com/ethdebug/format/commit/21e532e diff --git a/packages/format/src/types/type/index.ts b/packages/format/src/types/type/index.ts index 32c8bee84e..71efeb15fe 100644 --- a/packages/format/src/types/type/index.ts +++ b/packages/format/src/types/type/index.ts @@ -158,7 +158,7 @@ export namespace Type { value.bits % 8 === 0 && "places" in value && typeof value.places === "number" && - value.places >= 1 && + value.places >= 0 && value.places <= 80; export interface Fixed { @@ -180,7 +180,7 @@ export namespace Type { value.bits % 8 === 0 && "places" in value && typeof value.places === "number" && - value.places >= 1 && + value.places >= 0 && value.places <= 80; export interface Bool { diff --git a/schemas/type/elementary/fixed.schema.yaml b/schemas/type/elementary/fixed.schema.yaml index 61bf0206c2..5792600312 100644 --- a/schemas/type/elementary/fixed.schema.yaml +++ b/schemas/type/elementary/fixed.schema.yaml @@ -20,7 +20,7 @@ properties: description: How many decimal places, implying that a raw value `v` of this type should be interpreted as `v / (10**places)` - minimum: 1 + minimum: 0 maximum: 80 required: - kind @@ -30,3 +30,6 @@ examples: - kind: fixed bits: 256 places: 10 + - kind: fixed + bits: 64 + places: 0 diff --git a/schemas/type/elementary/ufixed.schema.yaml b/schemas/type/elementary/ufixed.schema.yaml index f548c20f28..f433214101 100644 --- a/schemas/type/elementary/ufixed.schema.yaml +++ b/schemas/type/elementary/ufixed.schema.yaml @@ -20,7 +20,7 @@ properties: description: How many decimal places, implying that a raw value `v` of this type should be interpreted as `v / (10**places)` - minimum: 1 + minimum: 0 maximum: 80 required: - kind @@ -30,3 +30,6 @@ examples: - kind: ufixed bits: 256 places: 10 + - kind: ufixed + bits: 64 + places: 0