From f7f93a18a8eba6a930bcd1e782ad43580b2d0b1b Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 11 Jan 2024 17:53:14 +0100 Subject: [PATCH 1/5] Remove generic Hex primitive type --- apis/config/deposit_contract.yaml | 2 +- beacon-node-oapi.yaml | 2 -- types/altair/sync_committee.yaml | 2 +- types/p2p.yaml | 4 ++-- types/primitive.yaml | 11 ++++++----- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/apis/config/deposit_contract.yaml b/apis/config/deposit_contract.yaml index 02e17dd5..20720540 100644 --- a/apis/config/deposit_contract.yaml +++ b/apis/config/deposit_contract.yaml @@ -23,7 +23,7 @@ get: - example: "1" address: allOf: - - $ref: ../../beacon-node-oapi.yaml#/components/schemas/Hex + - $ref: ../../beacon-node-oapi.yaml#/components/schemas/ExecutionAddress - description: Hex encoded deposit contract address with 0x prefix - example: "0x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6" "500": diff --git a/beacon-node-oapi.yaml b/beacon-node-oapi.yaml index d7fb7be8..f3dc14be 100644 --- a/beacon-node-oapi.yaml +++ b/beacon-node-oapi.yaml @@ -283,8 +283,6 @@ components: $ref: './types/primitive.yaml#/Finalized' Root: $ref: './types/primitive.yaml#/Root' - Hex: - $ref: './types/primitive.yaml#/Hex' Graffiti: $ref: './types/primitive.yaml#/Graffiti' Signature: diff --git a/types/altair/sync_committee.yaml b/types/altair/sync_committee.yaml index 1ccee2f8..8c112784 100644 --- a/types/altair/sync_committee.yaml +++ b/types/altair/sync_committee.yaml @@ -75,7 +75,7 @@ Altair: aggregation_bits: allOf: - description: 'A bit is set if a signature from the validator at the corresponding index in the subcommittee is present in the aggregate `signature`.' - - $ref: "../primitive.yaml#/Hex" + - $ref: "../primitive.yaml#/Bitvector" - example: "0x01" signature: allOf: diff --git a/types/p2p.yaml b/types/p2p.yaml index dce9f71d..69bb6c9f 100644 --- a/types/p2p.yaml +++ b/types/p2p.yaml @@ -33,12 +33,12 @@ MetaData: attnets: allOf: - description: "Bitvector representing the node's persistent attestation subnet subscriptions." - - $ref: "./primitive.yaml#/Hex" + - $ref: "./primitive.yaml#/Bitvector" - example: "0x0000000000000000" syncnets: allOf: - description: "Bitvector representing the node's sync committee subnet subscriptions. This metadata is not present in phase0, but will be present in Altair." - - $ref: "./primitive.yaml#/Hex" + - $ref: "./primitive.yaml#/Bitvector" - example: "0x0f" Peer: diff --git a/types/primitive.yaml b/types/primitive.yaml index 4c44bad5..9ee8cc74 100644 --- a/types/primitive.yaml +++ b/types/primitive.yaml @@ -76,11 +76,6 @@ Graffiti: example: "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2" pattern: "^0x[a-fA-F0-9]{64}$" -Hex: - type: string - format: hex - pattern: "^0x[a-fA-F0-9]{2,}$" - Signature: type: string format: hex @@ -93,6 +88,12 @@ BitList: example: "0x01" pattern: "^0x[a-fA-F0-9]+$" +Bitvector: + type: string + format: hex + example: "0x01" + pattern: "^0x[a-fA-F0-9]+$" + Uint8: type: string description: "Unsigned 8 bit integer, max value 255" From 39cd66181980d24a790f43054130c744be30d68a Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 11 Jan 2024 17:54:04 +0100 Subject: [PATCH 2/5] Update example values --- apis/config/deposit_contract.yaml | 2 +- types/altair/sync_committee.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apis/config/deposit_contract.yaml b/apis/config/deposit_contract.yaml index 20720540..d8dd091c 100644 --- a/apis/config/deposit_contract.yaml +++ b/apis/config/deposit_contract.yaml @@ -25,6 +25,6 @@ get: allOf: - $ref: ../../beacon-node-oapi.yaml#/components/schemas/ExecutionAddress - description: Hex encoded deposit contract address with 0x prefix - - example: "0x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6" + - example: "0x00000000219ab540356cBB839Cbe05303d7705Fa" "500": $ref: ../../beacon-node-oapi.yaml#/components/responses/InternalError diff --git a/types/altair/sync_committee.yaml b/types/altair/sync_committee.yaml index 8c112784..b583bcd4 100644 --- a/types/altair/sync_committee.yaml +++ b/types/altair/sync_committee.yaml @@ -76,7 +76,7 @@ Altair: allOf: - description: 'A bit is set if a signature from the validator at the corresponding index in the subcommittee is present in the aggregate `signature`.' - $ref: "../primitive.yaml#/Bitvector" - - example: "0x01" + - example: "0xffffffffffffffffffffffffffffffff" signature: allOf: - $ref: '../primitive.yaml#/Signature' From 06e39045f4e8bc4a01eb9186083869e061c321fb Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 11 Jan 2024 18:06:33 +0100 Subject: [PATCH 3/5] Stricter pattern for Bitlist and Bitvector --- types/primitive.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/primitive.yaml b/types/primitive.yaml index 9ee8cc74..8e15e49b 100644 --- a/types/primitive.yaml +++ b/types/primitive.yaml @@ -86,13 +86,13 @@ BitList: type: string format: hex example: "0x01" - pattern: "^0x[a-fA-F0-9]+$" + pattern: "^0x([a-fA-F0-9]{2}){1,32}$" Bitvector: type: string format: hex example: "0x01" - pattern: "^0x[a-fA-F0-9]+$" + pattern: "^0x([a-fA-F0-9]{2}){1,32}$" Uint8: type: string From f09e2284cd49499712465755c39aac947d8974e5 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 12 Jan 2024 09:45:07 +0100 Subject: [PATCH 4/5] Simplify regex --- types/primitive.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/types/primitive.yaml b/types/primitive.yaml index 8e15e49b..daa23110 100644 --- a/types/primitive.yaml +++ b/types/primitive.yaml @@ -86,13 +86,13 @@ BitList: type: string format: hex example: "0x01" - pattern: "^0x([a-fA-F0-9]{2}){1,32}$" + pattern: "^0x[a-fA-F0-9]{2,64}$" Bitvector: type: string format: hex example: "0x01" - pattern: "^0x([a-fA-F0-9]{2}){1,32}$" + pattern: "^0x[a-fA-F0-9]{2,64}$" Uint8: type: string @@ -137,7 +137,7 @@ KZGCommitment: type: string format: hex pattern: "^0x[a-fA-F0-9]{96}$" - description: "A G1 curve point. Same as BLS standard \"is valid pubkey\" check but also allows `0x00..00` for point-at-infinity" + description: 'A G1 curve point. Same as BLS standard "is valid pubkey" check but also allows `0x00..00` for point-at-infinity' example: "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a" KZGProof: @@ -145,4 +145,3 @@ KZGProof: format: hex pattern: "^0x[a-fA-F0-9]{96}$" description: "A G1 curve point. Used for verifying that the `KZGCommitment` for a given `Blob` is correct." - From 9b9f88ba536dc5314eb97c3eb9c127209aeaae07 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 12 Jan 2024 09:47:10 +0100 Subject: [PATCH 5/5] Remove formatting changes --- types/primitive.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/primitive.yaml b/types/primitive.yaml index daa23110..1bb211b0 100644 --- a/types/primitive.yaml +++ b/types/primitive.yaml @@ -137,7 +137,7 @@ KZGCommitment: type: string format: hex pattern: "^0x[a-fA-F0-9]{96}$" - description: 'A G1 curve point. Same as BLS standard "is valid pubkey" check but also allows `0x00..00` for point-at-infinity' + description: "A G1 curve point. Same as BLS standard \"is valid pubkey\" check but also allows `0x00..00` for point-at-infinity" example: "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a" KZGProof: @@ -145,3 +145,4 @@ KZGProof: format: hex pattern: "^0x[a-fA-F0-9]{96}$" description: "A G1 curve point. Used for verifying that the `KZGCommitment` for a given `Blob` is correct." +