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

Develop #619

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3251bb2
chore: Remove obsolete bitcoin input parser and its test
TejasvOnly Nov 30, 2024
677e961
Merge pull request #608 from Cypherock/chore/remove-obsolete-bitcoin-…
vrockz747 Dec 11, 2024
90ddce5
fix: Python setup in ci
TejasvOnly Dec 14, 2024
382ba77
Merge pull request #616 from Cypherock/fix/ci
vrockz747 Dec 14, 2024
4f4dbc6
feat(app): Add starknet gen pubkey
vrockz747 Dec 11, 2024
bc9dd9c
chore: Add function docs
vrockz747 Dec 12, 2024
5e805ed
chore: Ci fix
vrockz747 Dec 13, 2024
a2f86f8
chore: Refactor starknet ecdsa operations
vrockz747 Dec 17, 2024
83fc294
feat(app): Add sign txn
vrockz747 Dec 12, 2024
d939931
fix(app): Proto options size
vrockz747 Dec 13, 2024
aeef9d9
chore: Add submodules
vrockz747 Dec 14, 2024
1b17339
fix: Sign gen minor bug
vrockz747 Dec 14, 2024
a46aefd
chore: Update submodule
vrockz747 Dec 14, 2024
2590c3c
fix: Relocate starknet init
vrockz747 Dec 16, 2024
fc02c36
chore: Add starknet verify amount
vrockz747 Dec 16, 2024
4cc6484
chore: Update starknet utxn proto
vrockz747 Dec 16, 2024
f8823f3
fix: Verify txn data
vrockz747 Dec 18, 2024
266e827
chore: Update base
vrockz747 Dec 18, 2024
462c196
chore: Complete verification data all txns
vrockz747 Dec 18, 2024
ea3033f
chore: Refactor sign utilities
vrockz747 Dec 18, 2024
bf7396f
chore: Review changes
vrockz747 Dec 23, 2024
9cc6e72
chore: Review changes
vrockz747 Dec 23, 2024
42479e6
Merge branch 'feat/starknet/refactored/base' into feat/starknet/refac…
vrockz747 Dec 23, 2024
f625d0a
chore: Update submodule and review changes
vrockz747 Jan 3, 2025
1bff1dd
chore: Remove dev build ci
vrockz747 Jan 3, 2025
d99c888
chore: Version bump(v0.6.1538++)
vrockz747 Jan 3, 2025
44a4e78
Merge pull request #617 from Cypherock/feat/starknet/refactored/sign-txn
TejasvOnly Jan 8, 2025
41d8d78
fix: Apped zeros when converting mpz to string
TejasvOnly Jan 9, 2025
33ca59f
chore: Version bump (patch++)
TejasvOnly Jan 9, 2025
0eab180
chore: Fix ci
TejasvOnly Jan 9, 2025
4a2dbf9
Merge pull request #614 from Cypherock/feat/starknet/refactored/base
TejasvOnly Jan 10, 2025
45640d9
Merge branch 'main' into develop
TejasvOnly Jan 11, 2025
e1464a1
Merge pull request #620 from Cypherock/merge/main->develop
TejasvOnly Jan 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 26 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- release**
paths:
- 'version.txt'
- "version.txt"

jobs:
build-firmwares:
Expand All @@ -25,30 +25,28 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.ref_type }} == 'tag'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./
- name: Publish a release
env:
TAG_NAME: ${{ github.ref_name }}
auth_token: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
run: |
chkmain=$(sha256sum Main-Release-outputs/Cypherock-Main.bin | cut -f -1 -d ' ')
chkinit=$(sha256sum Initial-Release-outputs/Cypherock-Initial.bin | cut -f -1 -d ' ')
APP_VERSION=$(cat version.txt | grep firmware | cut -f 2-2 -d '=' | awk -F ':' '{ print 0+$1 "." 0+$2 "." $3*2**8 + $4 }')
HW_VERSION=$(cat version.txt | grep hardware | cut -f 2-2 -d '=' | awk -F ':' '{ print 0+$1 "." 0+$2 "." $3*2**8 + $4 }')
echo ${APP_VERSION}:${HW_VERSION}
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${auth_token}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${REPOSITORY}/releases -d '{"tag_name":"'${TAG_NAME}'","target_commitish":"main","name":"'${TAG_NAME}'","body":"Application version: '${APP_VERSION}'\r\nHardware version: '${HW_VERSION}'\r\n## SHA256 of binaries:\r\n**Cypherock-Initial.bin** : '${chkinit}' \r\n**Cypherock-Main.bin** : '${chkmain}'","draft":true,"prerelease":false,"generate_release_notes":true}' > output.txt
echo "upload_url=$(cat output.txt | grep "\"upload_url\":" | cut -f 4-4 -d '"' | cut -f 1-1 -d '{')" >> $GITHUB_ENV
- name: Upload assets
env:
auth_token: ${{ secrets.GITHUB_TOKEN }}
run: |
content_type=$(file -b --mime-type Main-Release-outputs/Cypherock-Main.bin)
curl -X POST -H "Content-Type: ${content_type}" -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${auth_token}" -H "X-GitHub-Api-Version: 2022-11-28" ${upload_url}?name=Cypherock-Main.bin --data-binary @Main-Release-outputs/Cypherock-Main.bin
curl -X POST -H "Content-Type: ${content_type}" -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${auth_token}" -H "X-GitHub-Api-Version: 2022-11-28" ${upload_url}?name=Cypherock-Initial.bin --data-binary @Initial-Release-outputs/Cypherock-Initial.bin
curl -X POST -H "Content-Type: ${content_type}" -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${auth_token}" -H "X-GitHub-Api-Version: 2022-11-28" ${upload_url}?name=version.txt --data-binary @version.txt
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./
- name: Publish a release
env:
TAG_NAME: ${{ github.ref_name }}
auth_token: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
run: |
chkmain=$(sha256sum Main-Release-outputs/Cypherock-Main.bin | cut -f -1 -d ' ')
APP_VERSION=$(cat version.txt | grep firmware | cut -f 2-2 -d '=' | awk -F ':' '{ print 0+$1 "." 0+$2 "." $3*2**8 + $4 }')
HW_VERSION=$(cat version.txt | grep hardware | cut -f 2-2 -d '=' | awk -F ':' '{ print 0+$1 "." 0+$2 "." $3*2**8 + $4 }')
echo ${APP_VERSION}:${HW_VERSION}
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${auth_token}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${REPOSITORY}/releases -d '{"tag_name":"'${TAG_NAME}'","target_commitish":"main","name":"'${TAG_NAME}'","body":"Application version: '${APP_VERSION}'\r\nHardware version: '${HW_VERSION}'\r\n## SHA256 of binaries:\r\n**Cypherock-Main.bin** : '${chkmain}'","draft":true,"prerelease":false,"generate_release_notes":true}' > output.txt
echo "upload_url=$(cat output.txt | grep "\"upload_url\":" | cut -f 4-4 -d '"' | cut -f 1-1 -d '{')" >> $GITHUB_ENV
- name: Upload assets
env:
auth_token: ${{ secrets.GITHUB_TOKEN }}
run: |
content_type=$(file -b --mime-type Main-Release-outputs/Cypherock-Main.bin)
curl -X POST -H "Content-Type: ${content_type}" -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${auth_token}" -H "X-GitHub-Api-Version: 2022-11-28" ${upload_url}?name=Cypherock-Main.bin --data-binary @Main-Release-outputs/Cypherock-Main.bin
curl -X POST -H "Content-Type: ${content_type}" -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${auth_token}" -H "X-GitHub-Api-Version: 2022-11-28" ${upload_url}?name=version.txt --data-binary @version.txt
296 changes: 153 additions & 143 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,146 +7,151 @@ on:
- develop
pull_request:
branches:
- '**'
- "**"

jobs:
check-commit-msg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Validate PR commits
if: github.event_name == 'pull_request'
run: bash ./utilities/ci/test-commit-msg.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
- name: Validate PR commits
if: github.event_name == 'pull_request'
run: bash ./utilities/ci/test-commit-msg.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}

check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Restore clang-tools
id: cache-clang-tools
uses: actions/cache@v3
with:
path: clang-tools
key: clang-tools

- name: Check formatting
env:
CACHED: ${{ steps.cache-clang-tools.outputs.cache-hit }}
SHA_BASE: ${{ github.event.pull_request.base.sha }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-clang-tools.sh;
fi
PATH="$PATH:$(pwd)/clang-tools"
# Check event type here so ci chaching can take effect
if [ ${{ github.event_name }} = 'pull_request' ]; then
bash ./utilities/ci/format-checker.sh ${SHA_BASE}
fi
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Restore clang-tools
id: cache-clang-tools
uses: actions/cache@v3
with:
path: clang-tools
key: clang-tools

- name: Check formatting
env:
CACHED: ${{ steps.cache-clang-tools.outputs.cache-hit }}
SHA_BASE: ${{ github.event.pull_request.base.sha }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-clang-tools.sh;
fi
PATH="$PATH:$(pwd)/clang-tools"
# Check event type here so ci chaching can take effect
if [ ${{ github.event_name }} = 'pull_request' ]; then
bash ./utilities/ci/format-checker.sh ${SHA_BASE}
fi

static-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Restore clang-tools
id: cache-clang-tools
uses: actions/cache@v3
with:
path: clang-tools
key: clang-tools

- name: Check formatting
env:
CACHED: ${{ steps.cache-clang-tools.outputs.cache-hit }}
SHA_BASE: ${{ github.event.pull_request.base.sha }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-clang-tools.sh;
fi
PATH="$PATH:$(pwd)/clang-tools"
# Check event type here so ci chaching can take effect
if [ ${{ github.event_name }} = 'pull_request' ]; then
bash ./utilities/ci/static-analyzer.sh ${SHA_BASE}
fi
- name: Upload result
uses: actions/upload-artifact@v3
with:
name: clang-tidy-result
path: anaylysis.results
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Restore clang-tools
id: cache-clang-tools
uses: actions/cache@v3
with:
path: clang-tools
key: clang-tools

- name: Check formatting
env:
CACHED: ${{ steps.cache-clang-tools.outputs.cache-hit }}
SHA_BASE: ${{ github.event.pull_request.base.sha }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-clang-tools.sh;
fi
PATH="$PATH:$(pwd)/clang-tools"
# Check event type here so ci chaching can take effect
if [ ${{ github.event_name }} = 'pull_request' ]; then
bash ./utilities/ci/static-analyzer.sh ${SHA_BASE}
fi
- name: Upload result
uses: actions/upload-artifact@v3
with:
name: clang-tidy-result
path: anaylysis.results

build-firmwares:
needs: check-format
strategy:
fail-fast: false
matrix:
firmware: [main]
target: [release, dev]
target: [release]
platform: [device, simulator]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Restore build-tools
id: cache-build-tools
uses: actions/cache@v3
with:
path: build-tools
key: build-tools

- name: Restore arm-gcc
if: matrix.platform == 'device'
id: cache-arm-gcc
uses: actions/cache@v3
with:
path: arm-gcc
key: arm-gcc

- name: Restore proto-tools
id: cache-proto-tools
uses: actions/cache@v3
with:
path: proto-tools
key: proto-tools

- name: Install target dependencies
if: matrix.platform == 'device'
env:
CACHED: ${{ steps.cache-arm-gcc.outputs.cache-hit }}
PROTO_CACHED: ${{ steps.cache-proto-tools.outputs.cache-hit }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-arm-gcc.sh;
fi
if [ ! "${PROTO_CACHED}" = "true" ]; then
bash ./utilities/ci/setup-protoc.sh;
fi
pip install -r utilities/script/requirements.txt

- name: Install simulator dependencies
if: matrix.platform == 'simulator'
run: sudo apt update && sudo apt install libsdl2-dev --no-install-recommends -y

- name: Build binaries
env:
CACHED: ${{ steps.cache-build-tools.outputs.cache-hit }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-build-tools.sh;
fi
pip install -r vendor/nanopb/extra/requirements.txt
PATH="$PATH:$(pwd)/build-tools:$(pwd)/arm-gcc/bin:$(pwd)/proto-tools/bin"
./utilities/build.sh -u -f ${{ matrix.firmware }} -t ${{ matrix.target }} -p ${{ matrix.platform }}
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"

- name: Restore build-tools
id: cache-build-tools
uses: actions/cache@v3
with:
path: build-tools
key: build-tools

- name: Restore arm-gcc
if: matrix.platform == 'device'
id: cache-arm-gcc
uses: actions/cache@v3
with:
path: arm-gcc
key: arm-gcc

- name: Restore proto-tools
id: cache-proto-tools
uses: actions/cache@v3
with:
path: proto-tools
key: proto-tools

- name: Install target dependencies
if: matrix.platform == 'device'
env:
CACHED: ${{ steps.cache-arm-gcc.outputs.cache-hit }}
PROTO_CACHED: ${{ steps.cache-proto-tools.outputs.cache-hit }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-arm-gcc.sh;
fi
if [ ! "${PROTO_CACHED}" = "true" ]; then
bash ./utilities/ci/setup-protoc.sh;
fi
pip install -r utilities/script/requirements.txt

- name: Install simulator dependencies
if: matrix.platform == 'simulator'
run: sudo apt update && sudo apt install libsdl2-dev --no-install-recommends -y

- name: Build binaries
env:
CACHED: ${{ steps.cache-build-tools.outputs.cache-hit }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-build-tools.sh;
fi
pip install -r vendor/nanopb/extra/requirements.txt
PATH="$PATH:$(pwd)/build-tools:$(pwd)/arm-gcc/bin:$(pwd)/proto-tools/bin"
./utilities/build.sh -u -f ${{ matrix.firmware }} -t ${{ matrix.target }} -p ${{ matrix.platform }}

run-unit-tests:
needs: check-format
Expand All @@ -160,31 +165,36 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Restore build-tools
id: cache-build-tools
uses: actions/cache@v3
with:
path: build-tools
key: build-tools

- name: Install simulator dependencies
run: sudo apt update && sudo apt install libsdl2-dev --no-install-recommends -y

- name: Run tests
env:
CACHED: ${{ steps.cache-build-tools.outputs.cache-hit }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-build-tools.sh;
fi
PATH="$PATH:$(pwd)/build-tools"
pip install -r vendor/nanopb/extra/requirements.txt
# Ignore any non-zero exits from simulator run using '|| true'
bash ./utilities/run_unit_tests.sh -f ${{ matrix.firmware }} -p ${{ matrix.platform }} > test_results.txt || true
cat test_results.txt
# Unity prints "OK" if all tests pass, "FAIL" if tests fail; return 1 to indicate failure
if [ ! "$(tail -n 1 test_results.txt)" = "OK" ]; then exit 1; fi
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"

- name: Restore build-tools
id: cache-build-tools
uses: actions/cache@v3
with:
path: build-tools
key: build-tools

- name: Install simulator dependencies
run: sudo apt update && sudo apt install libsdl2-dev --no-install-recommends -y

- name: Run tests
env:
CACHED: ${{ steps.cache-build-tools.outputs.cache-hit }}
run: |
if [ ! "${CACHED}" = "true" ]; then
bash ./utilities/ci/setup-build-tools.sh;
fi
PATH="$PATH:$(pwd)/build-tools"
pip install -r vendor/nanopb/extra/requirements.txt
# Ignore any non-zero exits from simulator run using '|| true'
bash ./utilities/run_unit_tests.sh -f ${{ matrix.firmware }} -p ${{ matrix.platform }} > test_results.txt || true
cat test_results.txt
# Unity prints "OK" if all tests pass, "FAIL" if tests fail; return 1 to indicate failure
if [ ! "$(tail -n 1 test_results.txt)" = "OK" ]; then exit 1; fi
Loading
Loading