Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Implementation of BlockchainHandler and CrankkModule for Kade…
…na Integration (#1) This pull request introduces the initial implementation of the **BlockchainHandler** and **CrankkModule** classes, designed to facilitate interactions with Kadena smart contracts. These changes aim to establish foundational connectivity and operational protocols for blockchain interactions within our network modules. - **BlockchainHandler Class**: Manages blockchain operations such as syncing nodes and executing blockchain commands. Implements robust Wi-Fi connectivity checks to ensure operations are performed only when network conditions are favorable. Utilizes secure cryptographic methods for handling sensitive data related to blockchain transactions. - **CrankkModule Class**: Manages and processes specific mesh network packets crucial for blockchain interactions, utilizing the BlockchainHandler to effectively integrate blockchain capabilities. - **Wallet configuration** Enable configuration of wallet private and public keys via the web client interface, allowing for secure and user-friendly management of blockchain credentials. --------- Co-authored-by: Peter Varga <[email protected]> Conditional Compilation and Redefined 'strptime' (#3) This PR introduces conditional compilation directives across the Blockchain modules to exclude webserver-related code when MESHTASTIC_EXCLUDE_WEBSERVER is defined. Additionally, it redefines the strptime function within BlockchainHandler.cpp to address issues related to IRAM overflow when calling HTTPClient functions. The changes ensure that the system can be compiled with or without webserver components based on configuration, enhancing modularity and flexibility in builds. 1. Added #if !MESHTASTIC_EXCLUDE_WEBSERVER guards in BlockchainHandler.cpp, #if !MESHTASTIC_EXCLUDE_CRANKK in CrankkModule.cpp, and Modules.cpp to conditionally compile blockchain related code. 2. Redefined strptime in BlockchainHandler.cpp to use sscanf for parsing date-time strings, which helps in avoiding potential IRAM overflow issues in certain devices. These modifications are aimed at improving the configurability of the system, allowing for builds tailored to specific needs and hardware capabilities. Fix memory leaks in JSON object creation (#2) This PR addresses several issues in the BlockchainHandler class, including fixing memory leaks and improving the WiFi availability check. The changes ensure better memory management and consistency in WiFi status checks, enhancing the stability and reliability of the system. 1. Memory Management Improvements: Added delete statements to properly free dynamically allocated JSONValue objects. Ensured that BlockchainHandler objects are properly deleted after use to prevent memory leaks. 2. WiFi Availability Check: Replaced the custom isWIFIavailable function with the existing isWifiAvailable function for consistency and reliability. 3. Logging Enhancements: Added logging to track heap memory usage before and after performing node synchronization in performNodeSync. These modifications are aimed at improving the memory management and operational consistency of the BlockchainHandler class, ensuring that resources are properly managed and the system remains stable during operation. Improve Beacon Check and Refactor BlockchainHandler to Use Enum for Status Handling (#4) This pull request refactors the `BlockchainHandler` class to use an enum (`BlockchainStatus`) for handling various states and errors, improving code readability and maintainability. Additionally, it enhances the logic for checking whether the node is ready to beacon by ensuring that there are no errors. - **Added `BlockchainStatus` Enum**: Introduced an enumeration to represent different states and errors, including `OK`, `NO_WIFI`, `HTTP_ERROR`, `EMPTY_RESPONSE`, `PARSING_ERROR`, `NODE_NOT_FOUND`, `READY`, and `NOT_DUE`. - **Implemented `blockchainStatusToString` Function**: Added a function to convert `BlockchainStatus` enum values to strings for logging purposes. - **Refactored `performNodeSync` Method**: Updated the method to use the new `BlockchainStatus` enum for handling different states and errors. The method now checks if the node is ready to beacon by ensuring that the status is `READY` and there are no errors. - **Updated `executeBlockchainCommand` and `parseBlockchainResponse` Methods**: Changed the return type to `BlockchainStatus` and updated the logic to return appropriate enum values. - **Better Error Handling**: The updated logic ensures that errors are handled appropriately and that the node is only ready to beacon when there are no errors. - **Improved Readability**: Using an enum for status handling makes the code more expressive and easier to understand. - **Enhanced Maintainability**: The refactored code is more structured and organized, making it easier to maintain and extend. Enhance BlockchainHandler with payload encryption (#5) This PR introduces significant enhancements to the BlockchainHandler class by adding encryption capabilities and refactoring utility functions into a new BlockchainUtils file. Additionally, it introduces a new EncryptionHandler class to encapsulate encryption-related functionalities. - Encryption Integration: Added encryption for payloads in BlockchainHandler using the director's public key. Introduced EncryptionHandler class to handle encryption tasks such as generating hashes, signatures, and encrypting payloads. - Refactoring: Moved utility functions like strptime, getCurrentTimestamp, and logLongString to a new utils.h file. Refactored BlockchainHandler to use EncryptionHandler for encryption-related tasks. - Command Handling: Modified parseBlockchainResponse to differentiate between commands and handle responses accordingly. Updated CrankkModule to fetch the director's public key before encrypting and sending data. - Code Cleanup: Removed redundant functions from BlockchainHandler and moved them to EncryptionHandler. Replaced raw pointers with std::unique_ptr for better memory management. Change LOG_INFO levels to LOG_DEBUG or LOG_TRACE - Security: Encrypting payloads enhances the security of data transmitted over the blockchain. - Modularity: Separating encryption logic into its own class (EncryptionHandler) improves code maintainability and readability. - Scalability: Refactoring utility functions into a separate file (utils.h) makes it easier to manage and extend utility functionalities. Remove Raspbian Build and Package Jobs from Workflow (#6) This PR removes the build-raspbian and package-raspbian jobs from the .github/workflows/main_matrix.yml file. The changes include: - Deleting the build-raspbian job configuration. - Deleting the package-raspbian job configuration. - Updating the gather-artifacts job dependencies to exclude build-raspbian and package-raspbian. These changes streamline the CI workflow by removing unnecessary steps related to Raspbian builds and packaging. --------- Co-authored-by: Peter Varga <[email protected]> Changes by create-pull-request action (#8) Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action Co-authored-by: jorblancoa <[email protected]> Update GitHub Actions to Use crankkio/web Repository (#9) This PR updates the GitHub Actions workflows to pull the web UI from the crankkio/web repository instead of the meshtastic/web repository. The changes affect the following workflow files: - build_esp32.yml - build_esp32_c3.yml - build_esp32_s3.yml - package_amd64.yml These updates ensure that the correct repository is used for fetching the web UI assets during the build and packaging processes. Changes by create-pull-request action (#11) Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action Co-authored-by: jorblancoa <[email protected]> Remove private key logging message (#12) Merge tag 'v2.3.15.deb7c27' from upstream (#13) Bump to 2.0.0 Bump to 2.3.15 Merge tag 'v2.4.2.5b45303' from upstream (#18) Merge tag 'v2.5.14.f2ee0df' from upstream
- Loading branch information