Skip to content
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

Update protobuf #17155

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Update protobuf #17155

wants to merge 2 commits into from

Conversation

mroz22
Copy link
Contributor

@mroz22 mroz22 commented Feb 21, 2025

changes don't appear to be breaking

Copy link

coderabbitai bot commented Feb 21, 2025

Walkthrough

The changes update Protocol Buffer message definitions and their TypeScript schemas. In the packages/protobuf/messages.json file, a new boolean field return_empty_state (defaulting to false) is added to the DebugLinkGetState message, and the mac field in the UnlockedPathRequest message is modified to be required and of type bytes. Corresponding updates in the TypeScript schema files (packages/protobuf/src/messages-schema.ts and packages/protobuf/src/messages.ts) change the mac property in the UnlockedPathRequest type from optional to required. Additionally, the submodule trezor-common is updated by advancing its commit reference to a newer version.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aadf4cc and 7ec0997.

📒 Files selected for processing (4)
  • packages/protobuf/messages.json (2 hunks)
  • packages/protobuf/src/messages-schema.ts (1 hunks)
  • packages/protobuf/src/messages.ts (1 hunks)
  • submodules/trezor-common (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • submodules/trezor-common
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=passphrase, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: transport-e2e-test
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: build-web
  • GitHub Check: build-web
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (5)
packages/protobuf/src/messages.ts (1)

1779-1779: LGTM! Security enhancement by making MAC required.

Making the mac property required in UnlockedPathRequest is a good security practice as it ensures that all unlocked path requests must include a Message Authentication Code for integrity and authentication.

packages/protobuf/src/messages-schema.ts (2)

2732-2732: LGTM! Making mac required improves type safety.

The change from Type.Optional(Type.String()) to Type.String() for the mac property in UnlockedPathRequest type ensures that the MAC (Message Authentication Code) is always provided, which is a good security practice as it helps prevent unauthorized path unlocking.


2729-2735:

❓ Verification inconclusive

Verify all usages of UnlockedPathRequest are updated.

Since making the mac property required is a breaking change, ensure all code that creates UnlockedPathRequest objects has been updated to always provide the mac property.

Let's verify all usages of UnlockedPathRequest in the codebase:


🏁 Script executed:

#!/bin/bash
# Search for usages of UnlockedPathRequest to ensure they provide the mac property
rg -A 5 "UnlockedPathRequest" 

Length of output: 3312


Action Required: Verify 'mac' Property Usage in UnlockedPathRequest Usages

The change making the mac property required necessitates that all instantiations of UnlockedPathRequest provide this field. Our search results indicate that the type definition is updated in both the schema (packages/protobuf/src/messages-schema.ts and packages/protobuf/src/messages.ts) and in the JSON serialization (packages/protobuf/messages.json). However, note the usage in:

  • packages/connect/src/device/DeviceCommands.ts – where UnlockedPathRequest is passed via this.typedCall('UnlockPath', 'UnlockedPathRequest', params);

Please verify that the params object supplied at this call (and in any other location where UnlockedPathRequest is used) always includes the required mac property.

packages/protobuf/messages.json (2)

2964-2971: New Field 'return_empty_state' Addition in DebugLinkGetState
A new boolean field return_empty_state (with default set to false) has been added to the DebugLinkGetState message. This addition increases the flexibility by allowing the message to explicitly signal when an empty state should be returned.
Please verify that all client and firmware components as well as the corresponding TypeScript schemas (in messages-schema.ts and messages.ts) have been updated to accommodate this new field.


5130-5133: Mandatory 'mac' Field Update in UnlockedPathRequest
The mac field within the UnlockedPathRequest message has been updated to be required and is defined with the type bytes. This change enforces that any request of this type must include a valid MAC value, thereby strengthening data integrity and security.
Please ensure that all parts of the codebase—particularly the TypeScript schemas and any request constructors—are updated to supply this mandatory field.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mroz22 mroz22 added the no-project This label is used to specify that PR doesn't need to be added to a project label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-project This label is used to specify that PR doesn't need to be added to a project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant