linera-protocol
linera-protocol copied to clipboard
Migrate parts of NodeError to linera-rpc
A few errors in NodeError are networking errors that don't really belong there. The simplest option of all could be to use NodeError::NetworkError { error: String } instead.
communicate_with_quorum currently takes a call operator that returns a Result<_, NodeError> (async). It feels like there are two or three nested categories of node errors:
- The validator itself encounters an error, serializes it and sends it as a response.
- Something goes wrong with networking or serialization, e.g. gRPC.
- The validator's response is invalid: A certificate for the wrong chain, an inconsistent chain info, etc.
Maybe the first one should be a (serializable) RemoteError.
And the second and third one should be NodeError (or ValidatorError) variants in addition to NodeError::Remote(RemoteError) (not necessarily serializable).
The third category is also the kind of error where the client might want to decide to ignore that validator in the future.