You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -33,7 +33,7 @@ The following message types SHALL be added to the `privval.Message` interface:
33
33
message SignRawBytesRequest {
34
34
string chain_id = 1;
35
35
bytes raw_bytes = 2;
36
-
uint32 unique_id = 3;
36
+
string unique_id = 3;
37
37
}
38
38
39
39
message SignedRawBytesResponse {
@@ -66,37 +66,60 @@ message Message {
66
66
67
67
### Field Specifications
68
68
69
-
-`chain_id`: The chain identifier to prevent cross-chain signature reuse.
70
-
-`raw_bytes`: The digest that is signed over. This can be any data that the consensus node includes, however note that the actual bytes signed over MUST be constructed as `chain_id + unique_id + raw_bytes`.
71
-
-`unique_id`: A required uint32 identifier for the specific protocol or message type being signed.
69
+
-`chain_id`: The chain identifier to prevent cross-chain signature reuse. It's required as it's used in signing and also routing in KMS implementation.
70
+
-`raw_bytes`: It's the data that needs to be signed over. Worth noting that this shouldn't be a digest, it needs to be the actual data, and it's a required field. The sign bytes are constructed as defined in the [sign bytes construction](#sign-bytes-construction) section.
71
+
-`unique_id`: A required string identifier for the specific protocol or message type being signed.
72
72
-`signature`: The resulting signature bytes from the signing operation.
73
73
-`error`: Error information if the signing operation fails.
74
74
75
75
### Sign Bytes Construction
76
76
77
-
The actual bytes that are signed MUST be constructed by concatenating:
78
-
79
-
```text
80
-
sign_bytes = chain_id + unique_id + raw_bytes
77
+
The actual bytes that are signed MUST be constructed by concatenating the domain separator `"COMET::RAW_BYTES::SIGN"` with the protobuf encoding of the `SignRawBytesRequest`:
78
+
79
+
```go
80
+
// RawBytesSignBytesPrefix defines a domain separator prefix added to raw bytes to ensure the resulting
81
+
// signed message can't be confused with a consensus message, which could lead to double signing
-`unique_id`: Decimal string representation of uint32 value encoded as UTF-8 bytes (e.g., uint32(123) → "123" → [0x31, 0x32, 0x33])
89
-
-`raw_bytes`: Raw byte sequence as-is, no additional encoding
90
-
91
115
### Implementation Requirements
92
116
93
117
1. KMS implementations MUST support the new message types for full compatibility.
94
118
2. The signing operation MUST use the same cryptographic key as consensus message signing.
95
119
3. The chain_id field MUST match the configured chain identifier.
96
120
4. Double-signing protection is NOT REQUIRED for raw message signing operations.
97
-
5. Convert each component to its byte representation as specified above
98
-
6. Concatenate the byte sequences directly without delimiters
99
-
7. Sign the resulting byte array
121
+
5. Generate the sign bytes as per the [sign bytes construction](#sign-bytes-construction) section.
122
+
6. Sign the resulting byte array.
100
123
101
124
## Rationale
102
125
@@ -114,7 +137,7 @@ For sign bytes construction, each component MUST be encoded as UTF-8 byte sequen
114
137
115
138
## Backwards Compatibility
116
139
117
-
This proposal is fully backwards compatible. Existing KMS implementations will continue to function normally, as the new message types use previously unused field numbers in the protobuf oneof union. That being said, all repos that import the interface MUST update their implementions to at least use a noop.
140
+
This proposal is fully backwards compatible. Existing KMS implementations will continue to function normally, as the new message types use previously unused field numbers in the protobuf oneof union. That being said, all repos that import the interface MUST update their implementations to at least use a noop.
0 commit comments