Skip to content

Commit

Permalink
Merge #642: ci: Various Fixes Nov 2022
Browse files Browse the repository at this point in the history
89cdd22 tests, ledger: Include wallet policy things in automation (Andrew Chow)
566914f ci, trezor: Make sure protobuf is upgraded for Trezor 1 (Andrew Chow)
90b7f2e ci, keepkey: Use updated protoc (Andrew Chow)
bfb4af5 ci, coldcard: Update patches (Andrew Chow)
c4ae425 ci, trezor: Use nightly rust (Andrew Chow)
b498a34 Remove unnecessary "type: ignore" (Andrew Chow)

Pull request description:

  Periodic CI fixing

  * Remove unneeded `type: ignore` that is causing the type checker to fail
  * Update Trezor T Sim Builder to use rust nightly
  * Update Coldcard patches to apply cleanly to latest Coldcard firmare
  * Ensure a recent protoc is being used since there has been a breaking change in python's protobuf implementation
  * Add additional things for Ledger Speculos automation to automatically accept

  Note that this does not fix CI entirely. There is still a failure in Ledger's `test_sign_msg` that appears to actually be an issue with our implementation and the new message signing implementation for Ledgers. This will be fixed in a followup PR.

Top commit has no ACKs.

Tree-SHA512: 68197873a447156bc55a89d4c1020902258a3f1239d58df4244df778aa85d29043f9fda9a9917123d1857d6dde14c76d5d3ff59700b5750cdccbc542a2d94955
  • Loading branch information
achow101 committed Nov 10, 2022
2 parents f767987 + 89cdd22 commit 44f26a8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 22 deletions.
4 changes: 3 additions & 1 deletion ci/cirrus.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ RUN apt-get install -y \
libusb-1.0-0-dev \
ninja-build \
pkg-config \
protobuf-compiler \
qemu-user-static \
swig

RUN pip install poetry flake8
RUN wget https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init
RUN chmod +x rustup-init && ./rustup-init -y
ENV PATH="/root/.cargo/bin:$PATH"
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-linux-x86_64.zip
RUN unzip protoc-21.9-linux-x86_64.zip -d /usr/local
RUN protoc --version

####################
# Local build/test steps
Expand Down
2 changes: 1 addition & 1 deletion hwilib/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def enumerate(password: str = "") -> List[Dict[str, Any]]:
for module in all_devs:
try:
imported_dev = importlib.import_module('.devices.' + module, __package__)
result.extend(imported_dev.enumerate(password)) # type: ignore
result.extend(imported_dev.enumerate(password))
except ImportError as e:
# Warn for ImportErrors, but largely ignore them to allow users not install
# all device dependencies if only one or some devices are wanted.
Expand Down
40 changes: 25 additions & 15 deletions test/data/coldcard-multisig.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From d217046502825fb238cca49546e2b314ccafa8ad Mon Sep 17 00:00:00 2001
From c2e4c24c226555903705aae0386aefe0e15bf873 Mon Sep 17 00:00:00 2001
From: Andrew Chow <achow101-github@achow101.com>
Date: Tue, 27 Nov 2018 17:32:44 -0500
Subject: [PATCH 1/3] Use linux unix socket address format
Expand Down Expand Up @@ -26,9 +26,10 @@ index d22bb1b..fe8e7ca 100644
try:
self.pipe.bind(addr)
--
2.33.0
2.38.1

From ea0fbe4eb7ba4c68ed60c262af3c1cea993061cb Mon Sep 17 00:00:00 2001

From fd51e85693e0d66129133b1f195134aead1cf7d0 Mon Sep 17 00:00:00 2001
From: Andrew Chow <achow101-github@achow101.com>
Date: Tue, 17 Dec 2019 17:56:05 -0500
Subject: [PATCH 2/3] Change default simulator multisig
Expand All @@ -38,10 +39,10 @@ Subject: [PATCH 2/3] Change default simulator multisig
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/unix/variant/sim_settings.py b/unix/variant/sim_settings.py
index 130f20c..4f0c46b 100644
index 2706fb4..f9b533d 100644
--- a/unix/variant/sim_settings.py
+++ b/unix/variant/sim_settings.py
@@ -68,7 +68,11 @@ if '--ms' in sys.argv:
@@ -71,7 +71,11 @@ if '--ms' in sys.argv:
sim_defaults['multisig'] = [["CC-2-of-4", [2, 4], [[1130956047, "tpubDF2rnouQaaYrUEy2JM1YD3RFzew4onawGM4X2Re67gguTf5CbHonBRiFGe3Xjz7DK88dxBFGf2i7K1hef3PM4cFKyUjcbJXddaY9F5tJBoP"], [3503269483, "tpubDFcrvj5n7gyatVbr8dHCUfHT4CGvL8hREBjtxc4ge7HZgqNuPhFimPRtVg6fRRwfXiQthV9EBjNbwbpgV2VoQeL1ZNXoAWXxP2L9vMtRjax"], [2389277556, "tpubDExj5FnaUnPAjjgzELoSiNRkuXJG8Cm1pbdiA4Hc5vkAZHphibeVcUp6mqH5LuNVKbtLVZxVSzyja5X26Cfmx6pzRH6gXBUJAH7MiqwNyuM"], [3190206587, "tpubDFiuHYSJhNbHaGtB5skiuDLg12tRboh2uVZ6KGXxr8WVr28pLcS7F3gv8SsHFa2tm1jtx3VAuw56YfgRkdo6DXyfp51oygTKY3nJFT5jBMt"]], {"pp": "48'/1'/0'/1'", "ch": "XTN", "ft": 26}]]
else:
# P2SH: 2of4 using BIP39 passwords: "Me", "Myself", "and I", and (empty string) on simulator
Expand All @@ -55,25 +56,26 @@ index 130f20c..4f0c46b 100644

if '--xfp' in sys.argv:
--
2.33.0
2.38.1


From 9c6a8f180bd2589c3e0700ea0c6724a2430ee713 Mon Sep 17 00:00:00 2001
From 04aecb1005d997783e63bd6cd830c4a98f099cb8 Mon Sep 17 00:00:00 2001
From: Andrew Chow <achow101-github@achow101.com>
Date: Wed, 27 Jan 2021 21:50:22 -0500
Subject: [PATCH 3/3] Allow multisigs to share master fingerprint

---
shared/multisig.py | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
shared/multisig.py | 40 +++++++++++++++++++++++++---------------
1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/shared/multisig.py b/shared/multisig.py
index 4ce66e4..a655516 100644
index 6f26644..6e190b5 100644
--- a/shared/multisig.py
+++ b/shared/multisig.py
@@ -142,9 +142,9 @@ class MultisigWallet:
@@ -144,9 +144,9 @@ class MultisigWallet:
# calc useful cache value: numeric xfp+subpath, with lookup
self.xfp_paths = {}
for xfp, deriv, _ in self.xpubs:
for xfp, deriv, xpub in self.xpubs:
- self.xfp_paths[xfp] = str_to_keypath(xfp, deriv)
+ self.xfp_paths.setdefault(xfp, list()).append(str_to_keypath(xfp, deriv))

Expand All @@ -82,7 +84,7 @@ index 4ce66e4..a655516 100644

@classmethod
def render_addr_fmt(cls, addr_fmt):
@@ -243,7 +243,11 @@ class MultisigWallet:
@@ -245,7 +245,11 @@ class MultisigWallet:

def get_xfp_paths(self):
# return list of lists [xfp, *deriv]
Expand All @@ -95,7 +97,15 @@ index 4ce66e4..a655516 100644

@classmethod
def find_match(cls, M, N, xfp_paths, addr_fmt=None):
@@ -281,17 +285,23 @@ class MultisigWallet:
@@ -280,24 +284,30 @@ class MultisigWallet:
# the same prefix path per-each xfp, as indicated
# xfp_paths (unordered)?
# - could also check non-prefix part is all non-hardened
- if len(xfp_paths) != len(self.xfp_paths):
+ if len(xfp_paths) != sum([len(x) for _, x in self.xfp_paths.items()]):
# cannot be the same if len(w0.N) != len(w1.N)
# maybe check duplicates first?
return False
for x in xfp_paths:
if x[0] not in self.xfp_paths:
return False
Expand Down Expand Up @@ -131,5 +141,5 @@ index 4ce66e4..a655516 100644

return True
--
2.33.0
2.38.1

2 changes: 1 addition & 1 deletion test/data/speculos-automation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": 1,
"rules": [
{
"regexp": "^(Address|Review|Amount|Fee|Confirm|The derivation|Derivation path|Reject if you're|The change path|Change path|external inputs|Register wallet|Policy map|Key|Path|Public key|Spend from).*",
"regexp": "^(Address|Review|Amount|Fee|Confirm|The derivation|Derivation path|Reject if you're|The change path|Change path|external inputs|Register wallet|Policy map|Key|Path|Public key|Spend from|Wallet name|Wallet policy).*",
"actions": [
[ "button", 2, true ],
[ "button", 2, false ]
Expand Down
10 changes: 6 additions & 4 deletions test/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ if [[ -n ${build_trezor_1} || -n ${build_trezor_t} ]]; then
# But there should be some caching that makes this faster
poetry install
cd legacy
export EMULATOR=1 TREZOR_TRANSPORT_V1=1 DEBUG_LINK=1 HEADLESS=1
export EMULATOR=1 TREZOR_TRANSPORT_V1=1 DEBUG_LINK=1 HEADLESS=1 PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
poetry run pip install -U protobuf
poetry run script/setup
poetry run script/cibuild
# Delete any emulator.img file
Expand All @@ -98,9 +99,10 @@ if [[ -n ${build_trezor_1} || -n ${build_trezor_t} ]]; then
fi

if [[ -n ${build_trezor_t} ]]; then
rustup toolchain uninstall stable
rustup toolchain install stable
rustup update
rustup toolchain uninstall nightly
rustup toolchain install nightly
rustup default nightly
# Build trezor t emulator. This is pretty fast, so rebuilding every time is ok
# But there should be some caching that makes this faster
poetry install
Expand Down Expand Up @@ -224,7 +226,7 @@ if [[ -n ${build_keepkey} ]]; then
make
cd ../../../
export PATH=$PATH:`pwd`/nanopb/generator
cmake -C cmake/caches/emulator.cmake . -DNANOPB_DIR=nanopb/ -DPROTOC_BINARY=/usr/bin/protoc
cmake -C cmake/caches/emulator.cmake . -DNANOPB_DIR=nanopb/ -DPROTOC_BINARY=/usr/local/bin/protoc
make
# Delete any emulator.img file
find . -name "emulator.img" -exec rm {} \;
Expand Down

0 comments on commit 44f26a8

Please sign in to comment.