chore(common): Deprecate data field in CosiCommit message.

pull/2455/head
Andrew Kozlik 2 years ago committed by matejcik
parent 70c1b12dff
commit ad5a572b75

@ -97,8 +97,8 @@ message ECDHSessionKey {
* @next Failure * @next Failure
*/ */
message CosiCommit { message CosiCommit {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional bytes data = 2; // Data to be signed optional bytes data = 2 [deprecated=true]; // Data to be signed. Deprecated in 1.10.2, the field is not needed, since CoSi commitments are no longer deterministic.
} }
/** /**

@ -1928,13 +1928,11 @@ if TYPE_CHECKING:
class CosiCommit(protobuf.MessageType): class CosiCommit(protobuf.MessageType):
address_n: "list[int]" address_n: "list[int]"
data: "bytes | None"
def __init__( def __init__(
self, self,
*, *,
address_n: "list[int] | None" = None, address_n: "list[int] | None" = None,
data: "bytes | None" = None,
) -> None: ) -> None:
pass pass

@ -6,7 +6,7 @@ CipherKeyValue.iv max_size:16
CipheredKeyValue.value max_size:1024 CipheredKeyValue.value max_size:1024
CosiCommit.address_n max_count:8 CosiCommit.address_n max_count:8
CosiCommit.data max_size:32 CosiCommit.data type:FT_IGNORE
CosiCommitment.commitment max_size:32 CosiCommitment.commitment max_size:32
CosiCommitment.pubkey max_size:32 CosiCommitment.pubkey max_size:32

@ -0,0 +1 @@
Remove DATA parameter from trezorctl cosi commit.

@ -14,7 +14,8 @@
# You should have received a copy of the License along with this library. # You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. # If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
from typing import TYPE_CHECKING import warnings
from typing import TYPE_CHECKING, Optional
import click import click
@ -35,14 +36,17 @@ def cli() -> None:
@cli.command() @cli.command()
@click.option("-n", "--address", required=True, help=PATH_HELP) @click.option("-n", "--address", required=True, help=PATH_HELP)
@click.argument("data") @click.argument("data_deprecated", required=False)
@with_client @with_client
def commit( def commit(
client: "TrezorClient", address: str, data: str client: "TrezorClient", address: str, data_deprecated: Optional[str]
) -> "messages.CosiCommitment": ) -> "messages.CosiCommitment":
"""Ask device to commit to CoSi signing.""" """Ask device to commit to CoSi signing."""
if data_deprecated is not None:
warnings.warn("'data' argument is deprecated")
address_n = tools.parse_path(address) address_n = tools.parse_path(address)
return cosi.commit(client, address_n, bytes.fromhex(data)) return cosi.commit(client, address_n)
@cli.command() @cli.command()

@ -14,8 +14,9 @@
# You should have received a copy of the License along with this library. # You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. # If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import warnings
from functools import reduce from functools import reduce
from typing import TYPE_CHECKING, Iterable, List, Tuple from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple
from . import _ed25519, messages from . import _ed25519, messages
from .tools import expect from .tools import expect
@ -141,8 +142,17 @@ def sign_with_privkey(
@expect(messages.CosiCommitment) @expect(messages.CosiCommitment)
def commit(client: "TrezorClient", n: "Address", data: bytes) -> "MessageType": def commit(
return client.call(messages.CosiCommit(address_n=n, data=data)) client: "TrezorClient", n: "Address", data: Optional[bytes] = None
) -> "MessageType":
if data is not None:
warnings.warn(
"'data' argument is deprecated",
DeprecationWarning,
stacklevel=2,
)
return client.call(messages.CosiCommit(address_n=n))
@expect(messages.CosiSignature) @expect(messages.CosiSignature)

Loading…
Cancel
Save