-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flesh out misbehavior reports #237
Changes from 3 commits
36390a9
28eeb27
552ca3f
490aa3a
1813d80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,45 @@ message OriginatorEnvelope { | |
BlockchainProof blockchain_proof = 3; | ||
} | ||
} | ||
|
||
enum Misbehavior { | ||
MISBEHAVIOR_UNSPECIFIED = 0; | ||
MISBEHAVIOR_UNRESPONSIVE_NODE = 1; | ||
MISBEHAVIOR_SLOW_NODE = 2; | ||
MISBEHAVIOR_FAILED_REQUEST = 3; | ||
MISBEHAVIOR_OUT_OF_ORDER = 4; | ||
MISBEHAVIOR_DUPLICATE_SEQUENCE_ID = 5; | ||
MISBEHAVIOR_CAUSAL_ORDERING = 6; | ||
MISBEHAVIOR_INVALID_PAYLOAD = 7; | ||
MISBEHAVIOR_BLOCKCHAIN_INCONSISTENCY = 8; | ||
} | ||
|
||
message LivenessFailure { | ||
uint32 response_time_ns = 1; | ||
SubscribeEnvelopesRequest subscribe = 2; | ||
QueryEnvelopesRequest query = 3; | ||
PublishPayerEnvelopesRequest publish = 4; | ||
} | ||
|
||
message SafetyFailure { | ||
repeated OriginatorEnvelope envelopes = 1; | ||
} | ||
|
||
message UnsignedMisbehaviorReport { | ||
uint64 reporter_time_ns = 1; | ||
uint32 misbehaving_node_id = 2; | ||
Misbehavior type = 3; | ||
LivenessFailure liveness = 4; | ||
SafetyFailure safety = 5; | ||
// Nodes must verify this field is false for client-submitted reports | ||
bool submitted_by_node = 6; | ||
} | ||
|
||
message MisbehaviorReport { | ||
// Server time when the report was stored. Used only for querying reports. | ||
// This field is not signed. | ||
uint64 server_time_ns = 1; | ||
bytes unsigned_misbehavior_report = 2; | ||
// Signed by the node hosting the report | ||
xmtp.identity.associations.RecoverableEcdsaSignature signature = 3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have the node's signature here. Alternative approaches:
When we define incentives for submitting reports, some entities may want to be rewarded. When we get there, perhaps we could add a |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,21 +8,6 @@ import "xmtpv4/envelopes/envelopes.proto"; | |
|
||
option go_package = "github.com/xmtp/proto/v3/go/xmtpv4/message_api"; | ||
|
||
// Misbehavior types | ||
enum Misbehavior { | ||
MISBEHAVIOR_UNSPECIFIED = 0; | ||
MISBEHAVIOR_UNAVAILABLE_NODE = 1; | ||
MISBEHAVIOR_OUT_OF_ORDER_ORIGINATOR_SID = 2; | ||
MISBEHAVIOR_DUPLICATE_ORIGINATOR_SID = 3; | ||
MISBEHAVIOR_CYCLICAL_MESSAGE_ORDERING = 4; | ||
} | ||
|
||
// Reports node misbehavior, submittable by nodes or by clients | ||
message MisbehaviorReport { | ||
Misbehavior type = 1; | ||
repeated xmtp.xmtpv4.envelopes.OriginatorEnvelope envelopes = 2; | ||
} | ||
|
||
// Query for envelopes, shared by query and subscribe endpoints | ||
// Either topics or originator_node_ids may be set, but not both | ||
message EnvelopesQuery { | ||
|
@@ -83,37 +68,60 @@ message GetInboxIdsResponse { | |
repeated Response responses = 1; | ||
} | ||
|
||
// Replication API | ||
message SubmitMisbehaviorReportRequest { | ||
xmtp.xmtpv4.envelopes.UnsignedMisbehaviorReport report = 1; | ||
} | ||
|
||
message SubmitMisbehaviorReportResponse {} | ||
|
||
message QueryMisbehaviorReportsRequest { | ||
uint64 after_ns = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the minimum set of parameters we should be able to query by, but in the future it may make sense to add queries by |
||
} | ||
|
||
message QueryMisbehaviorReportsResponse { | ||
repeated xmtp.xmtpv4.envelopes.MisbehaviorReport reports = 1; | ||
} | ||
|
||
service ReplicationApi { | ||
// Subscribe to envelopes | ||
rpc SubscribeEnvelopes(SubscribeEnvelopesRequest) returns (stream SubscribeEnvelopesResponse) { | ||
option (google.api.http) = { | ||
post: "/mls/v2/subscribe-envelopes" | ||
body: "*" | ||
}; | ||
} | ||
|
||
// Query envelopes | ||
rpc QueryEnvelopes(QueryEnvelopesRequest) returns (QueryEnvelopesResponse) { | ||
option (google.api.http) = { | ||
post: "/mls/v2/query-envelopes" | ||
body: "*" | ||
}; | ||
} | ||
|
||
// Publish envelope | ||
rpc PublishPayerEnvelopes(PublishPayerEnvelopesRequest) returns (PublishPayerEnvelopesResponse) { | ||
option (google.api.http) = { | ||
post: "/mls/v2/publish-payer-envelopes" | ||
body: "*" | ||
}; | ||
} | ||
|
||
// Get inbox ids | ||
rpc GetInboxIds(GetInboxIdsRequest) returns (GetInboxIdsResponse) { | ||
option (google.api.http) = { | ||
post: "/mls/v2/get-inbox-ids" | ||
body: "*" | ||
}; | ||
} | ||
|
||
rpc SubmitMisbehaviorReport(SubmitMisbehaviorReportRequest) returns (SubmitMisbehaviorReportResponse) { | ||
option (google.api.http) = { | ||
post: "/mls/v2/submit-misbehavior-report" | ||
body: "*" | ||
}; | ||
} | ||
|
||
rpc QueryMisbehaviorReports(QueryMisbehaviorReportsRequest) returns (QueryMisbehaviorReportsResponse) { | ||
option (google.api.http) = { | ||
post: "/mls/v2/query-misbehavior-reports" | ||
body: "*" | ||
}; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this separately to the reporter time (which may have client clock skew), so that the query endpoint can query all payloads larger than a certain timestamp. Could have used a sequence ID or a timestamp, decided to use a timestamp so that it's simpler, while also avoiding confusion with cursors in the main replication protocol