Revert "stop testing broken upstream version-2-0" (#6506)

* Revert "stop testing broken upstream version-2-0 (#6499)"

This reverts commit 2be7eba25a.

* fix field warning template
This commit is contained in:
Jacek Sieka 2024-08-23 12:18:06 +02:00 committed by GitHub
parent e4f18cba09
commit 42c4ea109c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 22 deletions

View File

@ -35,8 +35,18 @@ jobs:
cpu: amd64 cpu: amd64
- os: windows - os: windows
cpu: amd64 cpu: amd64
branch: [~] branch: [~, upstream/version-2-0]
exclude:
- target:
os: macos
branch: upstream/version-2-0
- target:
os: windows
branch: upstream/version-2-0
include: include:
- branch: upstream/version-2-0
branch-short: version-2-0
nimflags-extra: --mm:refc
- target: - target:
os: linux os: linux
builder: ['self-hosted','ubuntu-22.04'] builder: ['self-hosted','ubuntu-22.04']

View File

@ -1397,12 +1397,12 @@ proc readValue*(
raiseUnexpectedValue( raiseUnexpectedValue(
reader, "Expected a valid hex string with " & $value.len() & " bytes") reader, "Expected a valid hex string with " & $value.len() & " bytes")
template unrecognizedFieldWarning = template unrecognizedFieldWarning(fieldNameParam, typeNameParam: string) =
# TODO: There should be a different notification mechanism for informing the # TODO: There should be a different notification mechanism for informing the
# caller of a deserialization routine for unexpected fields. # caller of a deserialization routine for unexpected fields.
# The chonicles import in this module should be removed. # The chonicles import in this module should be removed.
trace "JSON field not recognized by the current version of Nimbus. Consider upgrading", trace "JSON field not recognized by the current version of Nimbus. Consider upgrading",
fieldName, typeName = typetraits.name(typeof value) fieldName = fieldNameParam, typeName = typeNameParam
template unrecognizedFieldIgnore = template unrecognizedFieldIgnore =
discard readValue(reader, JsonString) discard readValue(reader, JsonString)
@ -1433,7 +1433,7 @@ template prepareForkedBlockReading(blockType: typedesc,
"Multiple '" & fieldName & "' fields found", blockType.name) "Multiple '" & fieldName & "' fields found", blockType.name)
data = Opt.some(reader.readValue(JsonString)) data = Opt.some(reader.readValue(JsonString))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, blockType.name)
of "block_header", "block": of "block_header", "block":
when (blockType is Web3SignerForkedBeaconBlock): when (blockType is Web3SignerForkedBeaconBlock):
if data.isSome(): if data.isSome():
@ -1441,7 +1441,7 @@ template prepareForkedBlockReading(blockType: typedesc,
"Multiple '" & fieldName & "' fields found", blockType.name) "Multiple '" & fieldName & "' fields found", blockType.name)
data = Opt.some(reader.readValue(JsonString)) data = Opt.some(reader.readValue(JsonString))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, blockType.name)
of "execution_payload_blinded": of "execution_payload_blinded":
when (blockType is ProduceBlockResponseV3): when (blockType is ProduceBlockResponseV3):
if blinded.isSome(): if blinded.isSome():
@ -1449,7 +1449,7 @@ template prepareForkedBlockReading(blockType: typedesc,
"Multiple `execution_payload_blinded` fields found", blockType.name) "Multiple `execution_payload_blinded` fields found", blockType.name)
blinded = Opt.some(reader.readValue(bool)) blinded = Opt.some(reader.readValue(bool))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, blockType.name)
of "execution_payload_value": of "execution_payload_value":
when (blockType is ProduceBlockResponseV3): when (blockType is ProduceBlockResponseV3):
if payloadValue.isSome(): if payloadValue.isSome():
@ -1457,7 +1457,7 @@ template prepareForkedBlockReading(blockType: typedesc,
"Multiple `execution_payload_value` fields found", blockType.name) "Multiple `execution_payload_value` fields found", blockType.name)
payloadValue = Opt.some(reader.readValue(Uint256)) payloadValue = Opt.some(reader.readValue(Uint256))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, blockType.name)
of "consensus_block_value": of "consensus_block_value":
when (blockType is ProduceBlockResponseV3): when (blockType is ProduceBlockResponseV3):
if blockValue.isSome(): if blockValue.isSome():
@ -1465,9 +1465,9 @@ template prepareForkedBlockReading(blockType: typedesc,
"Multiple `consensus_block_value` fields found", blockType.name) "Multiple `consensus_block_value` fields found", blockType.name)
blockValue = Opt.some(reader.readValue(Uint256)) blockValue = Opt.some(reader.readValue(Uint256))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, blockType.name)
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, blockType.name)
if version.isNone(): if version.isNone():
reader.raiseUnexpectedValue("Field `version` is missing") reader.raiseUnexpectedValue("Field `version` is missing")
@ -1709,7 +1709,7 @@ proc readValue*(reader: var JsonReader[RestJson],
"RestPublishedBeaconBlockBody") "RestPublishedBeaconBlockBody")
blob_kzg_commitments = Opt.some(reader.readValue(KzgCommitments)) blob_kzg_commitments = Opt.some(reader.readValue(KzgCommitments))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if randao_reveal.isNone(): if randao_reveal.isNone():
reader.raiseUnexpectedValue("Field `randao_reveal` is missing") reader.raiseUnexpectedValue("Field `randao_reveal` is missing")
@ -1924,7 +1924,7 @@ proc readValue*(reader: var JsonReader[RestJson],
"RestPublishedBeaconBlock") "RestPublishedBeaconBlock")
blockBody = Opt.some(reader.readValue(RestPublishedBeaconBlockBody)) blockBody = Opt.some(reader.readValue(RestPublishedBeaconBlockBody))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if slot.isNone(): if slot.isNone():
reader.raiseUnexpectedValue("Field `slot` is missing") reader.raiseUnexpectedValue("Field `slot` is missing")
@ -2021,7 +2021,7 @@ proc readValue*(reader: var JsonReader[RestJson],
"RestPublishedSignedBeaconBlock") "RestPublishedSignedBeaconBlock")
signature = Opt.some(reader.readValue(ValidatorSig)) signature = Opt.some(reader.readValue(ValidatorSig))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if signature.isNone(): if signature.isNone():
reader.raiseUnexpectedValue("Field `signature` is missing") reader.raiseUnexpectedValue("Field `signature` is missing")
@ -2098,7 +2098,7 @@ proc readValue*(reader: var JsonReader[RestJson],
"RestPublishedSignedBlockContents") "RestPublishedSignedBlockContents")
blobs = Opt.some(reader.readValue(deneb.Blobs)) blobs = Opt.some(reader.readValue(deneb.Blobs))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if signed_message.isSome(): if signed_message.isSome():
if message.isSome(): if message.isSome():
@ -2178,7 +2178,7 @@ proc readValue*(reader: var JsonReader[RestJson],
"ForkedSignedBeaconBlock") "ForkedSignedBeaconBlock")
data = Opt.some(reader.readValue(JsonString)) data = Opt.some(reader.readValue(JsonString))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if version.isNone(): if version.isNone():
reader.raiseUnexpectedValue("Field version is missing") reader.raiseUnexpectedValue("Field version is missing")
@ -2310,7 +2310,7 @@ proc readValue*(reader: var JsonReader[RestJson],
"ForkedBeaconState") "ForkedBeaconState")
data = Opt.some(reader.readValue(JsonString)) data = Opt.some(reader.readValue(JsonString))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if version.isNone(): if version.isNone():
reader.raiseUnexpectedValue("Field version is missing") reader.raiseUnexpectedValue("Field version is missing")
@ -2440,7 +2440,7 @@ proc readValue*[T: SomeForkedLightClientObject](
reader.raiseUnexpectedField("Multiple data fields found", T.name) reader.raiseUnexpectedField("Multiple data fields found", T.name)
data.ok reader.readValue(JsonString) data.ok reader.readValue(JsonString)
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if version.isNone: if version.isNone:
reader.raiseUnexpectedValue("Field version is missing") reader.raiseUnexpectedValue("Field version is missing")
@ -2630,7 +2630,7 @@ proc readValue*(reader: var JsonReader[RestJson],
data = Opt.some(reader.readValue(JsonString)) data = Opt.some(reader.readValue(JsonString))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if requestKind.isNone(): if requestKind.isNone():
reader.raiseUnexpectedValue("Field `type` is missing") reader.raiseUnexpectedValue("Field `type` is missing")
@ -2875,7 +2875,7 @@ proc readValue*(reader: var JsonReader[RestJson],
reader.raiseUnexpectedValue("Invalid `status` value") reader.raiseUnexpectedValue("Invalid `status` value")
) )
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if status.isNone(): if status.isNone():
reader.raiseUnexpectedValue("Field `status` is missing") reader.raiseUnexpectedValue("Field `status` is missing")
@ -2932,7 +2932,7 @@ proc readValue*(reader: var JsonReader[RestJson], value: var Pbkdf2Params) {.
"Pbkdf2Params") "Pbkdf2Params")
salt = Opt.some(reader.readValue(Pbkdf2Salt)) salt = Opt.some(reader.readValue(Pbkdf2Salt))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if dklen.isNone(): if dklen.isNone():
reader.raiseUnexpectedValue("Field `dklen` is missing") reader.raiseUnexpectedValue("Field `dklen` is missing")
@ -3006,7 +3006,7 @@ proc readValue*(reader: var JsonReader[RestJson], value: var ScryptParams) {.
"ScryptParams") "ScryptParams")
salt = Opt.some(reader.readValue(ScryptSalt)) salt = Opt.some(reader.readValue(ScryptSalt))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if dklen.isNone(): if dklen.isNone():
reader.raiseUnexpectedValue("Field `dklen` is missing") reader.raiseUnexpectedValue("Field `dklen` is missing")
@ -3075,7 +3075,7 @@ proc readValue*(reader: var JsonReader[RestJson],
"KeystoresAndSlashingProtection") "KeystoresAndSlashingProtection")
strSlashing = Opt.some(reader.readValue(string)) strSlashing = Opt.some(reader.readValue(string))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
if len(strKeystores) == 0: if len(strKeystores) == 0:
reader.raiseUnexpectedValue("Missing or empty `keystores` value") reader.raiseUnexpectedValue("Missing or empty `keystores` value")
@ -4385,7 +4385,7 @@ proc readValue*(reader: var JsonReader[RestJson],
"RestValidatorRequest") "RestValidatorRequest")
statuses = Opt.some(reader.readValue(seq[string])) statuses = Opt.some(reader.readValue(seq[string]))
else: else:
unrecognizedFieldWarning() unrecognizedFieldWarning(fieldName, typeof(value).name)
let let
validatorIds = validatorIds =