mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-18 05:28:40 +00:00
Revert "feat(common): mark CoSi fields as required"
This reverts commit ce307c9484
.
This commit is contained in:
parent
1ea05a0018
commit
1861acaca1
@ -106,8 +106,8 @@ message CosiCommit {
|
||||
* @end
|
||||
*/
|
||||
message CosiCommitment {
|
||||
required bytes commitment = 1; // Commitment
|
||||
required bytes pubkey = 2; // Public key
|
||||
optional bytes commitment = 1; // Commitment
|
||||
optional bytes pubkey = 2; // Public key
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,9 +118,9 @@ message CosiCommitment {
|
||||
*/
|
||||
message CosiSign {
|
||||
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||
required bytes data = 2; // Data to be signed
|
||||
required bytes global_commitment = 3; // Aggregated commitment
|
||||
required bytes global_pubkey = 4; // Aggregated public key
|
||||
optional bytes data = 2; // Data to be signed
|
||||
optional bytes global_commitment = 3; // Aggregated commitment
|
||||
optional bytes global_pubkey = 4; // Aggregated public key
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1993,14 +1993,14 @@ if TYPE_CHECKING:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class CosiCommitment(protobuf.MessageType):
|
||||
commitment: "bytes"
|
||||
pubkey: "bytes"
|
||||
commitment: "bytes | None"
|
||||
pubkey: "bytes | None"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
commitment: "bytes",
|
||||
pubkey: "bytes",
|
||||
commitment: "bytes | None" = None,
|
||||
pubkey: "bytes | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -2010,17 +2010,17 @@ if TYPE_CHECKING:
|
||||
|
||||
class CosiSign(protobuf.MessageType):
|
||||
address_n: "list[int]"
|
||||
data: "bytes"
|
||||
global_commitment: "bytes"
|
||||
global_pubkey: "bytes"
|
||||
data: "bytes | None"
|
||||
global_commitment: "bytes | None"
|
||||
global_pubkey: "bytes | None"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
data: "bytes",
|
||||
global_commitment: "bytes",
|
||||
global_pubkey: "bytes",
|
||||
address_n: "list[int] | None" = None,
|
||||
data: "bytes | None" = None,
|
||||
global_commitment: "bytes | None" = None,
|
||||
global_pubkey: "bytes | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
|
@ -276,6 +276,8 @@ void fsm_msgCosiCommit(const CosiCommit *msg) {
|
||||
cosi_nonce_is_set = true;
|
||||
}
|
||||
|
||||
resp->has_commitment = true;
|
||||
resp->has_pubkey = true;
|
||||
resp->commitment.size = 32;
|
||||
resp->pubkey.size = 32;
|
||||
|
||||
@ -291,9 +293,11 @@ void fsm_msgCosiSign(const CosiSign *msg) {
|
||||
|
||||
CHECK_INITIALIZED
|
||||
|
||||
CHECK_PARAM(msg->global_commitment.size == 32,
|
||||
CHECK_PARAM(msg->has_data, _("No data provided"));
|
||||
CHECK_PARAM(msg->has_global_commitment && msg->global_commitment.size == 32,
|
||||
_("Invalid global commitment"));
|
||||
CHECK_PARAM(msg->global_pubkey.size == 32, _("Invalid global pubkey"));
|
||||
CHECK_PARAM(msg->has_global_pubkey && msg->global_pubkey.size == 32,
|
||||
_("Invalid global pubkey"));
|
||||
|
||||
if (!cosi_nonce_is_set) {
|
||||
fsm_sendFailure(FailureType_Failure_ProcessError, _("CoSi nonce not set"));
|
||||
|
@ -3027,15 +3027,15 @@ class CosiCommit(protobuf.MessageType):
|
||||
class CosiCommitment(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 72
|
||||
FIELDS = {
|
||||
1: protobuf.Field("commitment", "bytes", repeated=False, required=True),
|
||||
2: protobuf.Field("pubkey", "bytes", repeated=False, required=True),
|
||||
1: protobuf.Field("commitment", "bytes", repeated=False, required=False, default=None),
|
||||
2: protobuf.Field("pubkey", "bytes", repeated=False, required=False, default=None),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
commitment: "bytes",
|
||||
pubkey: "bytes",
|
||||
commitment: Optional["bytes"] = None,
|
||||
pubkey: Optional["bytes"] = None,
|
||||
) -> None:
|
||||
self.commitment = commitment
|
||||
self.pubkey = pubkey
|
||||
@ -3045,18 +3045,18 @@ class CosiSign(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 73
|
||||
FIELDS = {
|
||||
1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None),
|
||||
2: protobuf.Field("data", "bytes", repeated=False, required=True),
|
||||
3: protobuf.Field("global_commitment", "bytes", repeated=False, required=True),
|
||||
4: protobuf.Field("global_pubkey", "bytes", repeated=False, required=True),
|
||||
2: protobuf.Field("data", "bytes", repeated=False, required=False, default=None),
|
||||
3: protobuf.Field("global_commitment", "bytes", repeated=False, required=False, default=None),
|
||||
4: protobuf.Field("global_pubkey", "bytes", repeated=False, required=False, default=None),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
data: "bytes",
|
||||
global_commitment: "bytes",
|
||||
global_pubkey: "bytes",
|
||||
address_n: Optional[Sequence["int"]] = None,
|
||||
data: Optional["bytes"] = None,
|
||||
global_commitment: Optional["bytes"] = None,
|
||||
global_pubkey: Optional["bytes"] = None,
|
||||
) -> None:
|
||||
self.address_n: Sequence["int"] = address_n if address_n is not None else []
|
||||
self.data = data
|
||||
|
Loading…
Reference in New Issue
Block a user