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

feat: Ledger device support #199

Merged
merged 31 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c9ef5f8
create LedgerIdentity
adamspofford-dfinity May 11, 2023
d9a4ef7
Integrate with flags
adamspofford-dfinity May 15, 2023
8251114
functional ledger mvp
adamspofford-dfinity May 25, 2023
d2b05ba
update to master branch
adamspofford-dfinity May 26, 2023
bf72909
Merge branch 'master' into spofford/ledger
adamspofford-dfinity Jun 8, 2023
e5c6b6d
Update tests post merge
adamspofford-dfinity Jun 8, 2023
3213113
Add tests
adamspofford-dfinity Jun 8, 2023
88b0989
Update PR template
adamspofford-dfinity Jun 8, 2023
d6d42fd
Update CONTRIBUTING.md
adamspofford-dfinity Jun 8, 2023
47d6a07
.
adamspofford-dfinity Jun 8, 2023
dfacdd6
Update sns transfer tests for timestamp
adamspofford-dfinity Jun 8, 2023
5361aef
fix linux libusb
adamspofford-dfinity Jun 8, 2023
4e704f6
Factor out build dependencies into separate provision script
adamspofford-dfinity Jun 8, 2023
310b20f
install correct udev
adamspofford-dfinity Jun 8, 2023
15ebd7b
not going to work on armv6 or musl
adamspofford-dfinity Jun 8, 2023
db7f7b1
whoops
adamspofford-dfinity Jun 9, 2023
71b5222
how did that happen
adamspofford-dfinity Jun 9, 2023
dfb71e8
Update README
adamspofford-dfinity Jun 9, 2023
bb287e0
Update changelog
adamspofford-dfinity Jun 9, 2023
4ebf00f
Docs
adamspofford-dfinity Jun 9, 2023
c9fc798
Better errors
adamspofford-dfinity Jun 9, 2023
a26c1b0
.
adamspofford-dfinity Jun 9, 2023
3de3892
rustfmt
adamspofford-dfinity Jun 12, 2023
4b4a974
Move test directories
adamspofford-dfinity Jun 12, 2023
7e19f43
Change next_stake setup
adamspofford-dfinity Jun 12, 2023
1fb26f7
Add comments, fail unsupported ledger operations early
adamspofford-dfinity Jun 14, 2023
fcea158
Test what we don't forbid, forbid what we don't test
adamspofford-dfinity Jun 14, 2023
7417a16
forgot sns transfer
adamspofford-dfinity Jun 14, 2023
52ce16b
cleanup
adamspofford-dfinity Jun 14, 2023
9eaef82
Docs
adamspofford-dfinity Jun 14, 2023
c9a6387
whoops
adamspofford-dfinity Jun 14, 2023
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
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Fixes # (issue)

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

# Checklist:
# Checklist

- [ ] I have made corresponding changes to the documentation in src/docs.
- [ ] I have made corresponding changes to the documentation in docs/cli-reference.
- [ ] I have added corresponding integration tests.
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
command: cargo clippy --all --all-targets --all-features --tests -- -D warnings
- name: Test
command: cargo test
include:
- os: ubuntu-latest
build_deps: scripts/workflows/provision-linux-build.sh
- os: macos-latest
build_deps: scripts/workflows/provision-darwin-build.sh
- os: windows-latest
build_deps: scripts/workflows/provision-windows-build.ps1
env:
VCPKG_ROOT: 'C:\vcpkg'
steps:
Expand All @@ -34,14 +41,8 @@ jobs:
${{ env.VCPKG_ROOT }}
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ env.rust }}-ci-1

- name: Install dependencies (windows only)
if: ${{ contains(matrix.os, 'windows') }}
shell: bash
run: |
vcpkg integrate install
vcpkg install openssl:x64-windows-static-md
echo "OPENSSL_DIR=C:\vcpkg\installed\x64-windows-static-md" >> $GITHUB_ENV
echo "OPENSSL_STATIC=Yes" >> $GITHUB_ENV
- name: Install dependencies
run: ${{ matrix.build_deps }}

- uses: actions-rs/toolchain@v1
with:
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ jobs:
fail-fast: false
matrix:
# windows not supported by dfx
os: [ubuntu-latest, macos-latest]
binary_path: ["target/release"]
include:
- os: ubuntu-latest
binary_path: target/release
build_deps: scripts/workflows/provision-linux-build.sh
- os: macos-latest
binary_path: target/release
build_deps: scripts/workflows/provision-darwin-build.sh
steps:
- uses: actions/checkout@master

Expand All @@ -36,6 +41,8 @@ jobs:
toolchain: ${{ env.rust }}
override: true
# components: rustfmt, clippy
- name: Install dependencies
run: ${{ matrix.build_deps }}

- name: Build release
run: cargo build --release --locked
Expand Down Expand Up @@ -78,10 +85,10 @@ jobs:
run: chmod +x /usr/local/bin/quill
- name: Provision Darwin
if: ${{ contains(matrix.os, 'macos') }}
run: bash scripts/workflows/provision-darwin.sh
run: bash scripts/workflows/provision-darwin-e2e.sh
- name: Provision Linux
if: ${{ contains(matrix.os, 'ubuntu') }}
run: bash scripts/workflows/provision-linux.sh
run: bash scripts/workflows/provision-linux-e2e.sh
- name: Prepare environment
run: |
echo "archive=$(pwd)/e2e/archive" >> "$GITHUB_ENV"
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,24 @@ jobs:
name: windows
target_file: target/release/quill.exe
asset_name: quill-windows-x86_64.exe
build_deps: scripts/workflows/provision-windows-build.ps1
- os: macos-latest
name: macos
target_file: target/release/quill
asset_name: quill-macos-x86_64
build_deps: scripts/workflows/provision-darwin-build.sh
- os: ubuntu-latest
name: linux-arm32
target: arm-unknown-linux-gnueabihf
cross: true
target_file: target/arm-unknown-linux-gnueabihf/release-arm/quill
asset_name: quill-linux-arm32
features: [static-ssl, hsm]
- os: ubuntu-latest
name: linux
target_file: target/release/quill
asset_name: quill-linux-x86_64
build_deps: scripts/workflows/provision-linux-build.sh
env:
VCPKG_ROOT: 'C:\vcpkg'
steps:
Expand All @@ -55,14 +59,9 @@ jobs:
${{ env.VCPKG_ROOT }}
key: ${{ matrix.os }}-cargo-${{ env.rust }}-release-1

- name: Install dependencies (windows only)
if: ${{ contains(matrix.os, 'windows') }}
shell: bash
run: |
vcpkg integrate install
vcpkg install openssl:x64-windows-static-md
echo "OPENSSL_DIR=C:\vcpkg\installed\x64-windows-static-md" >> $GITHUB_ENV
echo "OPENSSL_STATIC=Yes" >> $GITHUB_ENV
- name: Install dependencies
if: ${{ matrix.build_deps }}
run: ${{ matrix.build_deps }}

- name: Install toolchain
uses: actions-rs/toolchain@v1
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Added Ledger support via `--ledger`. (#199)
- Added `--confirmation-text` to `quill sns pay`. (#195)
- Fixed `quill ckbtc update-balance` allowing the anonymous principal. (#191)
- Added `disburse`, `disburse-maturity`, `split-neuron`, and `follow-neuron` to `quill sns`. (#191)
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ All code contributions are subject to our [Contributor License Agreement (CLA)](
Quill has three kinds of tests to be aware of:

- Rust unit tests. Add these whenever internal helpers are added or changed, using standard Rust test conventions.
- Output tests. These are located in `tests/output-tests`. Add these whenever the command interface is updated. Each test is an integration test dry-running a `quill` command; its output is checked against a file in `outputs`. Set `FIX_OUTPUTS=1` when running `cargo test` to generate this file for a new test. Ensure that the output contains Candid field names rather than field hashes.
- Output tests. These are located in `tests/output`. Add these whenever the command interface is updated. Each test is an integration test dry-running a `quill` command; its output is checked against a file in `default`. Set `FIX_OUTPUTS=1` when running `cargo test` to generate this file for a new test. Ensure that the output contains Candid field names rather than field hashes.
- Some output tests require a Ledger device. To run these tests, a Ledger Nano should be plugged in and initialized with the seed "equip will roof matter pink blind book anxiety banner elbow sun young", and the ICP app must be installed. Then run `cargo test -- --ignored` and accept each request on the device. These tests are manually run so if you do not own a Ledger device you will need to wait for the reviewer to notify you of test failures.
- End-to-end tests. These are located in `e2e/tests-quill`. These should be added whenever a test needs to be run against a real replica. They are run with [`bats`](https://github.com/bats-core/bats-core), and you will need to install [`dfx`](https://github.com/dfinity/sdk) and [`bats-support`](https://github.com/ztombol/bats-support), and point the `BATSLIB` environment variable to the `bats-support` installation path. More examples of writing tests for our E2E test setup can be found in the [SDK repository](https://github.com/dfinity/sdk).

The latter two require you to have run `cargo build` before executing them.

## Documentation

Every change to the command-line interface must contain documentation; we use `clap`, so Rustdoc comments turn into CLI documentation. Additionally, this in-code documentation must be mirrored by a corresponding change in `docs/cli-reference`. See existing doc pages for examples. Finally, any feature or notable bugfix should be mentioned in [CHANGELOG.md](CHANGELOG.md), under the `## Unreleased` header.
Expand Down
Loading