espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.71k stars 7.43k forks source link

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

Open Jason2866 opened 2 days ago

Jason2866 commented 2 days ago

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 https://github.com/espressif/arduino-esp32/pull/9893)

github-actions[bot] commented 2 days ago
Warnings
:warning: **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](https://www.conventionalcommits.org/en/v1.0.0/) - correct format of commit message should be: `(): `, 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](https://github.com/espressif/conventional-precommit-linter)).
:warning: 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
:book: 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 :no_entry_sign: dangerJS against cdc7ca1328c0d8f377921b5a7e08662f1624cf8d

me-no-dev commented 2 days ago

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
github-actions[bot] commented 2 days ago

Test Results

 61 files   61 suites   5m 46s ⏱️  21 tests  21 βœ…β€ƒ0 πŸ’€β€ƒ0 ❌ 143 runsβ€Šβ€ƒ143 βœ…β€ƒ0 πŸ’€β€ƒ0 ❌

Results for commit cdc7ca13.

:recycle: This comment has been updated with latest results.

Jason2866 commented 2 days ago

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.

github-actions[bot] commented 2 days ago

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:bangbang: +20K0.00:bangbang: +5.250:bangbang: +3K0.00:bangbang: +9.85
ESP32S20:bangbang: +15K0.00:bangbang: +3.870:bangbang: +2K0.00:bangbang: +10.32
ESP32C30:bangbang: +25K0.00:bangbang: +3.640:bangbang: +2K0.00:bangbang: +12.88
ESP32C60:bangbang: +42K0.00:bangbang: +4.620:bangbang: +25K0.00:bangbang: +62.48
ESP32H20:bangbang: +9K0.00:bangbang: +2.790:warning: +15840.00:bangbang: +11.44
ESP320:bangbang: +20K0.00:bangbang: +4.090:warning: +17920.00:bangbang: +4.61
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
Update/examples/AWS_S3_OTA_Update--:bangbang: +20K:bangbang: +3K:bangbang: +15K:bangbang: +2K:bangbang: +22K:bangbang: +2K:bangbang: +42K:bangbang: +24K--:bangbang: +19K:warning: +1784
Update/examples/HTTPS_OTA_Update--:bangbang: +19K:bangbang: +3K:bangbang: +15K:bangbang: +2K:bangbang: +25K:warning: +1728:bangbang: +40K:bangbang: +24K--:bangbang: +20K:warning: +1792
Update/examples/HTTP_Client_AES_OTA_Update--:bangbang: +19K:bangbang: +3K:bangbang: +15K:bangbang: +2K:bangbang: +21K:bangbang: +2K:bangbang: +41K:bangbang: +25K--:bangbang: +18K:warning: +1780
Update/examples/HTTP_Server_AES_OTA_Update--:bangbang: +18K:bangbang: +3K:bangbang: +14K:bangbang: +2K:bangbang: +20K:bangbang: +2K:bangbang: +40K:bangbang: +24K--:bangbang: +18K:warning: +1792
Update/examples/OTAWebUpdater--:bangbang: +19K:bangbang: +3K:bangbang: +15K:bangbang: +2K:bangbang: +21K:bangbang: +2K:bangbang: +40K:bangbang: +25K--:bangbang: +18K:warning: +1768
Update/examples/SD_Update--:bangbang: +19K:warning: +1896:bangbang: +13K:warning: +1524:bangbang: +12K:warning: +1644:bangbang: +13K:warning: +1644:bangbang: +9K:warning: +1584:bangbang: +14K:warning: +972
me-no-dev commented 2 days ago
  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 commented 2 days ago

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....