Engine API: forkChoiceUpdated V2 And V3 should return invalidPayloadAttributes error instead of invalidParams error upon receiving erroneous payload attributes

This commit is contained in:
jangko 2024-04-17 15:45:39 +07:00
parent d6a4205324
commit 6c1afe1127
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 15 additions and 15 deletions

View File

@ -485,7 +485,7 @@ let cancunTestList* = [
- Payload Attributes uses Shanghai timestamp - Payload Attributes uses Shanghai timestamp
- Payload Attributes' Beacon Root is nil - Payload Attributes' Beacon Root is nil
Verify that client returns INVALID_PARAMS_ERROR. Verify that client returns INVALID_PAYLOAD_ATTRIBUTES.
""", """,
run: specExecute, run: specExecute,
spec: CancunSpec( spec: CancunSpec(
@ -494,11 +494,11 @@ let cancunTestList* = [
testSequence: @[ testSequence: @[
NewPayloads( NewPayloads(
fcUOnPayloadRequest: UpgradeForkchoiceUpdatedVersion( fcUOnPayloadRequest: UpgradeForkchoiceUpdatedVersion(
expectedError: engineApiInvalidParams, expectedError: engineApiInvalidPayloadAttributes,
), ),
expectationDescription: """ expectationDescription: """
ForkchoiceUpdatedV3 before Cancun with any nil field must return INVALID_PARAMS_ERROR (code $1) ForkchoiceUpdatedV3 before Cancun with any nil field must return INVALID_PAYLOAD_ATTRIBUTES (code $1)
""" % [$engineApiInvalidParams], """ % [$engineApiInvalidPayloadAttributes],
).TestStep, ).TestStep,
] ]
), ),
@ -539,7 +539,7 @@ let cancunTestList* = [
- Payload Attributes uses Shanghai timestamp - Payload Attributes uses Shanghai timestamp
- Payload Attributes' Beacon Root zero - Payload Attributes' Beacon Root zero
Verify that client returns INVALID_PARAMS_ERROR. Verify that client returns INVALID_PAYLOAD_ATTRIBUTES.
""", """,
run: specExecute, run: specExecute,
spec: CancunSpec( spec: CancunSpec(
@ -549,11 +549,11 @@ let cancunTestList* = [
NewPayloads( NewPayloads(
fcUOnPayloadRequest: DowngradeForkchoiceUpdatedVersion( fcUOnPayloadRequest: DowngradeForkchoiceUpdatedVersion(
beaconRoot: some(common.Hash256()), beaconRoot: some(common.Hash256()),
expectedError: engineApiInvalidParams, expectedError: engineApiInvalidPayloadAttributes,
), ),
expectationDescription: """ expectationDescription: """
ForkchoiceUpdatedV2 before Cancun with beacon root field must return INVALID_PARAMS_ERROR (code $1) ForkchoiceUpdatedV2 before Cancun with beacon root field must return INVALID_PAYLOAD_ATTRIBUTES (code $1)
""" % [$engineApiInvalidParams], """ % [$engineApiInvalidPayloadAttributes],
).TestStep, ).TestStep,
] ]
), ),
@ -567,7 +567,7 @@ let cancunTestList* = [
- Payload Attributes uses Cancun timestamp - Payload Attributes uses Cancun timestamp
- Payload Attributes' Beacon Root zero - Payload Attributes' Beacon Root zero
Verify that client returns INVALID_PARAMS_ERROR. Verify that client returns INVALID_PAYLOAD_ATTRIBUTES.
""", """,
run: specExecute, run: specExecute,
spec: CancunSpec( spec: CancunSpec(
@ -577,11 +577,11 @@ let cancunTestList* = [
NewPayloads( NewPayloads(
fcUOnPayloadRequest: DowngradeForkchoiceUpdatedVersion( fcUOnPayloadRequest: DowngradeForkchoiceUpdatedVersion(
beaconRoot: some(common.Hash256()), beaconRoot: some(common.Hash256()),
expectedError: engineApiInvalidParams, expectedError: engineApiInvalidPayloadAttributes,
), ),
expectationDescription: """ expectationDescription: """
ForkchoiceUpdatedV2 after Cancun with beacon root field must return INVALID_PARAMS_ERROR (code $1) ForkchoiceUpdatedV2 after Cancun with beacon root field must return INVALID_PAYLOAD_ATTRIBUTES (code $1)
""" % [$engineApiInvalidParams], """ % [$engineApiInvalidPayloadAttributes],
).TestStep, ).TestStep,
] ]
), ),

View File

@ -28,7 +28,7 @@ template validateVersion(attrsOpt, com, apiVersion) =
if apiVersion == Version.V3: if apiVersion == Version.V3:
if version != apiVersion: if version != apiVersion:
raise invalidParams("forkChoiceUpdatedV3 expect PayloadAttributesV3" & raise invalidAttr("forkChoiceUpdatedV3 expect PayloadAttributesV3" &
" but got PayloadAttributes" & $version) " but got PayloadAttributes" & $version)
if not com.isCancunOrLater(timestamp): if not com.isCancunOrLater(timestamp):
raise unsupportedFork( raise unsupportedFork(
@ -39,11 +39,11 @@ template validateVersion(attrsOpt, com, apiVersion) =
raise unsupportedFork("forkChoiceUpdated" & $apiVersion & raise unsupportedFork("forkChoiceUpdated" & $apiVersion &
" doesn't support payloadAttributes with Cancun timestamp") " doesn't support payloadAttributes with Cancun timestamp")
if version >= Version.V3: if version >= Version.V3:
raise invalidParams("forkChoiceUpdated" & $apiVersion & raise invalidAttr("forkChoiceUpdated" & $apiVersion &
" doesn't support PayloadAttributes" & $version) " doesn't support PayloadAttributes" & $version)
elif com.isShanghaiOrLater(timestamp): elif com.isShanghaiOrLater(timestamp):
if version != Version.V2: if version != Version.V2:
raise invalidParams("if timestamp is Shanghai or later," & raise invalidAttr("if timestamp is Shanghai or later," &
" payloadAttributes must be PayloadAttributesV2") " payloadAttributes must be PayloadAttributesV2")
else: else:
if version != Version.V1: if version != Version.V1: