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

Guard crypto parts in "Update" to save resources #10630

Open
wants to merge 5 commits into
base: release/v3.1.x
Choose a base branch
from

Conversation

Jason2866
Copy link
Collaborator

@Jason2866 Jason2866 commented Nov 20, 2024

This PR guards the crypto parts in library Update.
By doing this flash space is saved, since most users don't use crypto updates. To disable crypto updates just adding #define UPDATE_NOCRYPT to the sketch needs to be done.
(similar to #9893)

Copy link
Contributor

github-actions bot commented Nov 20, 2024

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "Update Updater.cpp":
    • summary looks empty
    • type/action looks empty
  • the commit message "change disable logic":
    • summary looks empty
    • type/action looks empty
  • the commit message "guard crypt update":
    • summary looks empty
    • type/action looks empty
  • the commit message "guard update crypt":
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 20 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

⚠️
	The **target branch** for this Pull Request **must be the default branch** of the project (`master`).

	If you would like to add this feature to a different branch, please state this in the PR description and we will consider it.
Messages
📖 You might consider squashing your 5 commits (simplifying branch history).

👋 Hello Jason2866, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- Addressing info messages (📖) is strongly recommended; they're less critical but valuable.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against cdc7ca1

@@ -63,6 +63,7 @@ class UpdateClass {
*/
bool begin(size_t size = UPDATE_SIZE_UNKNOWN, int command = U_FLASH, int ledPin = -1, uint8_t ledOn = LOW, const char *label = NULL);

#ifdef UPDATE_CRYPT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where would this UPDATE_CRYPT come from? Something is wrong here

@me-no-dev
Copy link
Member

We can not accept this as-is.

  1. Defining UPDATE_CRYPT in the sketch will not propagate the definition to Updater.cpp
  2. Your changes should not turn things OFF by default

Copy link
Contributor

github-actions bot commented Nov 20, 2024

Test Results

 61 files   61 suites   5m 46s ⏱️
 21 tests  21 ✅ 0 💤 0 ❌
143 runs  143 ✅ 0 💤 0 ❌

Results for commit cdc7ca1.

♻️ This comment has been updated with latest results.

@Jason2866
Copy link
Collaborator Author

1.) Why in #9893 it is done the same way?
2.) Logic changed to let crypto feature on, which is imho a bad default setting since nearly no one does crypto updates with Arduino. Waste of resources.

Copy link
Contributor

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32P4000.000.00000.000.00
ESP32S30‼️ +20K0.00‼️ +5.250‼️ +3K0.00‼️ +9.85
ESP32S20‼️ +15K0.00‼️ +3.870‼️ +2K0.00‼️ +10.32
ESP32C30‼️ +25K0.00‼️ +3.640‼️ +2K0.00‼️ +12.88
ESP32C60‼️ +42K0.00‼️ +4.620‼️ +25K0.00‼️ +62.48
ESP32H20‼️ +9K0.00‼️ +2.790⚠️ +15840.00‼️ +11.44
ESP320‼️ +20K0.00‼️ +4.090⚠️ +17920.00‼️ +4.61
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
Update/examples/AWS_S3_OTA_Update--‼️ +20K‼️ +3K‼️ +15K‼️ +2K‼️ +22K‼️ +2K‼️ +42K‼️ +24K--‼️ +19K⚠️ +1784
Update/examples/HTTPS_OTA_Update--‼️ +19K‼️ +3K‼️ +15K‼️ +2K‼️ +25K⚠️ +1728‼️ +40K‼️ +24K--‼️ +20K⚠️ +1792
Update/examples/HTTP_Client_AES_OTA_Update--‼️ +19K‼️ +3K‼️ +15K‼️ +2K‼️ +21K‼️ +2K‼️ +41K‼️ +25K--‼️ +18K⚠️ +1780
Update/examples/HTTP_Server_AES_OTA_Update--‼️ +18K‼️ +3K‼️ +14K‼️ +2K‼️ +20K‼️ +2K‼️ +40K‼️ +24K--‼️ +18K⚠️ +1792
Update/examples/OTAWebUpdater--‼️ +19K‼️ +3K‼️ +15K‼️ +2K‼️ +21K‼️ +2K‼️ +40K‼️ +25K--‼️ +18K⚠️ +1768
Update/examples/SD_Update--‼️ +19K⚠️ +1896‼️ +13K⚠️ +1524‼️ +12K⚠️ +1644‼️ +13K⚠️ +1644‼️ +9K⚠️ +1584‼️ +14K⚠️ +972

@me-no-dev
Copy link
Member

  1. It's not done the same way. It's the opposite, if something is NOT defined, then code stays the same. In your case something MUST be defined for the feature to stay the same
  2. There are people using the feature and we do get issue reports from time to time

@Jason2866
Copy link
Collaborator Author

The last commit change the behaviour to not change anything until the user sets the define.
Adding every possible feature and enabling by default is questionable. The feature is added not long ago. Core 3.0.x has more relevant breaking changes....

@me-no-dev me-no-dev added the Status: Review needed Issue or PR is awaiting review label Nov 20, 2024
@me-no-dev me-no-dev added this to the 3.1.0 milestone Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review needed Issue or PR is awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants