Check firmware version before install
What is this PR for?
For more info see issue https://github.com/selfcustody/krux/issues/582
I've tested with some old releases (signed with my key) and it detected. I've not used the lib re (REGex) because it is not available on our micropython.
To test (please someone test with m5stickv just to be sure):
- Build and Flash with this PR - put version "25.03.0" or something alike on pyproject.toml
- Sign the firmware and put .bin and .sig in the SD card - ./krux sign build/firmware.bin privkey.pem
- Try to update the firmware from SD card (it will fail because of version)
- Build and Sign again but put version "25.03.1" or something greater than the flashed one
- Try to update the firmware from SD card (it will succeed)
@qlrd if you want to increase test coverage I would be very happy :grin:
Note: Increased file read buffer size, it is now ~1,4s faster :rocket:
Changes made to:
- [x] Code
- [x] Tests
- [ ] Docs
- [x] CHANGELOG
Did you build the code and tested on device?
- [x] Yes - Yahboom
What is the purpose of this pull request?
- [ ] Bug fix
- [x] New feature
- [ ] Docs update
- [ ] Other
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.41%. Comparing base (
8dbd794) to head (e543a5f). Report is 5 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #583 +/- ##
===========================================
+ Coverage 95.35% 95.41% +0.05%
===========================================
Files 76 76
Lines 8619 8665 +46
===========================================
+ Hits 8219 8268 +49
+ Misses 400 397 -3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
I've finished this PR optimizations and test coverage with the help of @qlrd :grin: (EDIT: now coverage is 100% for firmware.py)
Plz someone do test with m5stickv:
- Build and Flash with this PR - put version "25.03.0" on
pyproject.toml. - Sign the firmware, put the files on SD card.
- Try to update the firmware from SD card will fail because of version.
- Now build and sign again with version "25.03.1" on
pyproject.toml. - Try to update the firmware from SD card will succeed.
Wow, great improvements!
Thank you