pub trait ProtocolError<Id>:
Display
+ Debug
+ Clone
+ Serialize
+ for<'de> Deserialize<'de> {
type AssociatedData: Debug;
// Required methods
fn required_messages(&self) -> RequiredMessages;
fn verify_messages_constitute_error(
&self,
format: &BoxedFormat,
guilty_party: &Id,
shared_randomness: &[u8],
associated_data: &Self::AssociatedData,
message: ProtocolMessage,
previous_messages: BTreeMap<RoundId, ProtocolMessage>,
combined_echos: BTreeMap<RoundId, BTreeMap<Id, EchoBroadcast>>,
) -> Result<(), ProtocolValidationError>;
}
Expand description
Describes provable errors originating during protocol execution.
Provable here means that we can create an evidence object entirely of messages signed by some party, which, in combination, prove the party’s malicious actions.
Required Associated Types§
Sourcetype AssociatedData: Debug
type AssociatedData: Debug
Additional data that cannot be derived from the node’s messages alone and therefore has to be supplied externally during evidence verification.
Required Methods§
Sourcefn required_messages(&self) -> RequiredMessages
fn required_messages(&self) -> RequiredMessages
Specifies the messages of the guilty party that need to be stored as the evidence to prove its malicious behavior.
Sourcefn verify_messages_constitute_error(
&self,
format: &BoxedFormat,
guilty_party: &Id,
shared_randomness: &[u8],
associated_data: &Self::AssociatedData,
message: ProtocolMessage,
previous_messages: BTreeMap<RoundId, ProtocolMessage>,
combined_echos: BTreeMap<RoundId, BTreeMap<Id, EchoBroadcast>>,
) -> Result<(), ProtocolValidationError>
fn verify_messages_constitute_error( &self, format: &BoxedFormat, guilty_party: &Id, shared_randomness: &[u8], associated_data: &Self::AssociatedData, message: ProtocolMessage, previous_messages: BTreeMap<RoundId, ProtocolMessage>, combined_echos: BTreeMap<RoundId, BTreeMap<Id, EchoBroadcast>>, ) -> Result<(), ProtocolValidationError>
Returns Ok(())
if the attached messages indeed prove that a malicious action happened.
The signatures and metadata of the messages will be checked by the calling code, the responsibility of this method is just to check the message contents.
message
contain the message parts that triggered the error
during Round::receive_message
.
previous_messages
are message parts from the previous rounds, as requested by
required_messages
.
Note that if some message part was not requested by above methods, it will be set to an empty one
in the ProtocolMessage
, even if it was present originally.
combined_echos
are bundled echos from other parties from the previous rounds,
as requested by required_messages
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.