lodestar
lodestar copied to clipboard
Multiple API errors are not spec compliant
Describe the bug
The beacon API spec notes that multiple API errors (e.g submitPoolAttestations) should return a 400 error with details of each failure.
If one or more attestations fail validation the node MUST return a 400 error with details of which attestations have failed, and why.
There was initial work on this to handle multiple errors (https://github.com/ChainSafe/lodestar/pull/2595), we just need to update the response format and status code.
Expected behavior
The response should be formatted like this
{
"code": 400,
"message": "some failures",
"failures": [
{
"index": 3,
"message": "invalid signature"
}
]
}
and return 400 http status code instead of 500
Steps to reproduce
Call any API that accepts an array of objects with invalid data.
Additional context
- https://github.com/ChainSafe/lodestar/pull/2595
Operating system
Linux
Lodestar version or commit hash
098d35aa0f5afc351a131b8a1e88485907985226
@nflaig Can I take this on?
- Related https://github.com/ChainSafe/lodestar/issues/6480