Skip to content

ETR01SDK-466: Refactor model#404

Merged
andreondra merged 49 commits intoETR01SDK-466-New-example-structure-proposalfrom
ETR01SDK-466-New-example-structure-proposal-refactor-model
Jan 9, 2026
Merged

ETR01SDK-466: Refactor model#404
andreondra merged 49 commits intoETR01SDK-466-New-example-structure-proposalfrom
ETR01SDK-466-New-example-structure-proposal-refactor-model

Conversation

@andreondra
Copy link
Contributor

@andreondra andreondra commented Jan 6, 2026

Description

This PR refactors model examples + tests.


Type of Change

Select the type(s) that best describe your change:

  • 🐛 Bug fix
  • ✨ New feature
  • 🧹 Code cleanup or refactoring
  • 📝 Documentation update
  • 🔧 Build system or toolchain update
  • 🔒 Security improvement
  • Other (please describe):

Checklist

Before submitting, please confirm that you have completed the following:

  • I opened the Pull Request to the develop branch
  • I followed the project's code guidelines
  • I formatted the code using clang-format with the recommended configuration
  • I updated the changelog, or this change does not require it (e.g., internal or non-functional update)
  • The project builds without errors or warnings
  • I have verified the functionality against the hardware/model as applicable
  • I have ensured that public APIs remain backward compatible (if applicable)
  • This PR is ready for review by maintainers (no WIP commits left) and marked as Ready for Review

Optional Checks

You can enable optional CI jobs by checking following boxes. For example, coverage job is useful when modifying or implementing new tests.

  • Measure Test Coverage

@andreondra andreondra self-assigned this Jan 6, 2026
@andreondra andreondra added functional tests New or modified functional tests scripts New or modified scripts examples New or modified examples labels Jan 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

Test Coverage Report

Results

GCC Code Coverage Report

📂 Overall coverage

Metric Coverage
Lines 🔴 1448/2129 (68.0%)
Functions 🟢 126/128 (98.4%)
Branches 🔴 858/1485 (57.8%)

📄 File coverage

File Lines Functions Branches
src/libtropic.c 🔴 621/953 (65.2%) 🟢 49/49 (100.0%) 🔴 465/735 (63.3%)
src/libtropic_l2.c 🔴 62/95 (65.3%) 🟡 4/5 (80.0%) 🔴 30/63 (47.6%)
src/libtropic_l3.c 🔴 530/734 (72.2%) 🟢 49/49 (100.0%) 🔴 263/498 (52.8%)
src/lt_asn1_der.c 🟡 71/79 (89.9%) 🟢 4/4 (100.0%) 🔴 39/62 (62.9%)
src/lt_crc16.c 🟢 23/23 (100.0%) 🟢 3/3 (100.0%) 🟢 6/6 (100.0%)
src/lt_hkdf.c 🟡 11/13 (84.6%) 🟢 1/1 (100.0%) 🔴 2/4 (50.0%)
src/lt_l1.c 🔴 34/87 (39.1%) 🔴 2/3 (66.7%) 🔴 17/48 (35.4%)
src/lt_l2_frame_check.c 🔴 15/31 (48.4%) 🟢 1/1 (100.0%) 🔴 6/14 (42.9%)
src/lt_l3_process.c 🔴 49/74 (66.2%) 🟢 4/4 (100.0%) 🔴 16/31 (51.6%)
src/lt_port_wrap.c 🟢 14/14 (100.0%) 🟢 7/7 (100.0%) ⚫ 0/0 (0.0%)
src/lt_secure_memzero.c 🔴 3/5 (60.0%) 🟢 1/1 (100.0%) 🔴 1/2 (50.0%)
src/lt_tr01_attrs.c 🔴 15/21 (71.4%) 🟢 1/1 (100.0%) 🔴 13/22 (59.1%)

@andreondra andreondra force-pushed the ETR01SDK-466-New-example-structure-proposal branch from b476970 to 04db0ab Compare January 7, 2026 07:54
@andreondra andreondra force-pushed the ETR01SDK-466-New-example-structure-proposal-refactor-model branch 2 times, most recently from b31a3c9 to 1e5484f Compare January 7, 2026 09:03
@andreondra andreondra requested a review from Copilot January 8, 2026 12:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the model implementation by restructuring the project layout. The main changes involve moving model-related files from tropic01_model/ to more appropriate locations and introducing a new example structure.

Key Changes:

  • Removed the standalone tropic01_model/ directory with its CMakeLists and main.c
  • Added structured model tests under tests/functional/model/ with new CMake configuration
  • Created a new Hello World example under examples/model/hello_world/
  • Moved model scripts and provisioning data to scripts/tropic01_model/
  • Updated documentation to reflect the new structure
  • Modified CI/CD workflows to work with the new layout

Reviewed changes

Copilot reviewed 26 out of 41 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
tropic01_model/main.c Removed standalone model main, replaced with structured test and example mains
tropic01_model/CMakeLists.txt Removed monolithic CMake config, split into separate test and example configurations
tests/functional/model/main.c New dedicated entrypoint for functional tests against model
tests/functional/model/CMakeLists.txt New CMake configuration for model functional tests
tests/functional/model/download_deps.sh New script to download external dependencies
examples/model/hello_world/main.c New Hello World example for model
examples/model/hello_world/CMakeLists.txt CMake config for Hello World example
scripts/tropic01_model/* Model scripts and provisioning data moved to scripts directory
docs/* Documentation updated to reflect new structure
.github/workflows/* CI/CD workflows updated for new directory structure
tests/functional/src/CMakeLists.txt Moved ASAN configuration to correct location

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to +21
git clone https://github.com/orlp/ed25519.git "$SCRIPT_DIR/_deps/ed25519"

echo "Downloading Micro ECC..."
curl -L -o "$SCRIPT_DIR/_deps/micro-ecc.zip" "https://github.com/kmackay/micro-ecc/archive/refs/tags/v1.1.zip"
unzip "$SCRIPT_DIR/_deps/micro-ecc.zip" -d "$SCRIPT_DIR/_deps"
mv "$SCRIPT_DIR/_deps/micro-ecc-1.1" "$SCRIPT_DIR/_deps/micro-ecc"
rm "$SCRIPT_DIR/_deps/micro-ecc.zip"

echo "Downloading MbedTLSv4..."
curl -L -o "$SCRIPT_DIR/_deps/mbedtls.tar.bz2" "https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-4.0.0/mbedtls-4.0.0.tar.bz2"
tar -xjf "$SCRIPT_DIR/_deps/mbedtls.tar.bz2" -C "$SCRIPT_DIR/_deps"
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The download_deps.sh script fetches and builds third-party code (ed25519, micro-ecc, and mbedtls) directly from GitHub using git clone and curl without pinning to immutable commit hashes or verifying archive checksums. If any of these upstream repositories or release assets are compromised, an attacker can inject arbitrary code into your test binaries and gain code execution in developer or CI environments that run this script. To harden the supply chain, pin each dependency to a specific commit or content hash and verify archive integrity (e.g., via checksums or signatures) before building and executing the downloaded code.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

@andreondra andreondra left a comment

Choose a reason for hiding this comment

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

For some reason, comment originally for #408 was pulished here. Moved.

@medexs medexs mentioned this pull request Jan 8, 2026
16 tasks
Copy link
Contributor

@medexs medexs left a comment

Choose a reason for hiding this comment

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

These comments are just ideas. Implementation of other suggestions is in this PR.

@medexs medexs changed the title ETR01-SDK-466: Refactor model ETR01SDK-466: Refactor model Jan 8, 2026
andreondra and others added 26 commits January 9, 2026 15:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@andreondra andreondra force-pushed the ETR01SDK-466-New-example-structure-proposal-refactor-model branch from f133b68 to a8d6e07 Compare January 9, 2026 14:14
@andreondra andreondra marked this pull request as ready for review January 9, 2026 14:16
@andreondra andreondra merged commit 5087adf into ETR01SDK-466-New-example-structure-proposal Jan 9, 2026
1 check passed
@andreondra andreondra deleted the ETR01SDK-466-New-example-structure-proposal-refactor-model branch January 9, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples New or modified examples functional tests New or modified functional tests scripts New or modified scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants