Skip to content

Commit 5cfb546

Browse files
authored
Merge pull request keepkey#167 from keepkey/btc-only
Btc only
2 parents 0c0dfd8 + 2eefc7f commit 5cfb546

50 files changed

Lines changed: 1101 additions & 208 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,74 @@
1-
version: 2
1+
version: 2 # keep 2.0 syntax; CircleCI 2.1 also works
2+
23
jobs:
34
emulator-build-test:
45
docker:
5-
- image: circleci/python:3.7
6+
- image: circleci/python:3.7 # upgrade to cimg/python:3.12 if you like
67
steps:
7-
- checkout:
8-
path: .pykk
8+
# ────────────────────────────────────────────────────────────────
9+
# 1) Pull python-keepkey via HTTPS so no SSH key is required
10+
# ────────────────────────────────────────────────────────────────
11+
- run:
12+
name: Clone python-keepkey
13+
command: git clone --depth 1 https://github.com/keepkey/python-keepkey.git .pykk
14+
15+
# ────────────────────────────────────────────────────────────────
16+
# 2) Grab firmware repo and inject our fresh python-keepkey copy
17+
# ────────────────────────────────────────────────────────────────
918
- run:
10-
name: Checkout Firmware & Inject python-keepkey
19+
name: Checkout firmware & inject python-keepkey
1120
command: |
21+
# Ensure all submodule URLs fall back to HTTPS
1222
git config --global url."https://github.com/".insteadOf git@github.com:
1323
git config --global url."https://".insteadOf git://
24+
25+
# Move python-keepkey out of the way for the moment
1426
mv .pykk ../
15-
git clone $FIRMWARE_REPO --depth 1 -b master .
27+
28+
# Clone firmware repository (expects $FIRMWARE_REPO env var)
29+
git clone --depth 1 -b master "$FIRMWARE_REPO" .
30+
31+
# Initialise firmware submodules
1632
git submodule update --init --recursive
33+
34+
# Replace the vendor copy with our freshly–cloned python-keepkey
1735
rm -rf deps/python-keepkey
1836
mv ../.pykk deps/python-keepkey
37+
38+
# Pull python-keepkey submodules too
1939
cd deps/python-keepkey
2040
git submodule update --init --recursive
41+
cd ../../..
42+
43+
# ────────────────────────────────────────────────────────────────
44+
# 3) Build the Docker-based emulator tests
45+
# ────────────────────────────────────────────────────────────────
2146
- setup_remote_docker
47+
2248
- run:
23-
name: Emulator Tests
49+
name: Emulator tests
2450
command: |
2551
pushd ./scripts/emulator
26-
set +e
52+
set +e # don’t exit on first failure
2753
docker-compose up --build firmware-unit
2854
docker-compose up --build python-keepkey
2955
set -e
56+
57+
# Collect JUnit / pytest XML results
3058
mkdir -p ../../test-reports
3159
docker cp "$(docker-compose ps -q firmware-unit)":/kkemu/test-reports/. ../../test-reports/
3260
docker cp "$(docker-compose ps -q python-keepkey)":/kkemu/test-reports/. ../../test-reports/
3361
popd
34-
[ "$(cat test-reports/python-keepkey/status)$(cat test-reports/firmware-unit/status)" == "00" ] || exit 1
62+
63+
# Fail job if either container reported non-zero status
64+
[ "$(cat test-reports/python-keepkey/status)$(cat test-reports/firmware-unit/status)" = "00" ] || exit 1
65+
3566
- store_test_results:
3667
path: test-reports
68+
69+
# ──────────────────────────────────────────────────────────────────────
3770
workflows:
3871
version: 2
3972
emulator:
4073
jobs:
4174
- emulator-build-test
42-

build_pb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CURDIR=$(pwd)
33
cd "device-protocol"
44

55
echo "Building with protoc version: $(protoc --version)"
6-
for i in messages messages-ethereum messages-eos messages-nano messages-cosmos messages-ripple messages-binance messages-tendermint messages-thorchain messages-osmosis types ; do
6+
for i in messages messages-ethereum messages-eos messages-nano messages-cosmos messages-ripple messages-binance messages-tendermint messages-thorchain messages-osmosis messages-mayachain types ; do
77
protoc --python_out=$CURDIR/keepkeylib/ -I/usr/include -I. $i.proto
88
i=${i/-/_}
99
sed -i -Ee 's/^import ([^.]+_pb2)/from . import \1/' $CURDIR/keepkeylib/"$i"_pb2.py

keepkeylib/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from . import messages_ripple_pb2 as ripple_proto
4545
from . import messages_tendermint_pb2 as tendermint_proto
4646
from . import messages_thorchain_pb2 as thorchain_proto
47+
from . import messages_mayachain_pb2 as mayachain_proto
4748
from . import types_pb2 as types
4849
from . import eos
4950
from . import nano
@@ -362,6 +363,7 @@ def __init__(self, *args, **kwargs):
362363
# Always press Yes and provide correct pin
363364
self.setup_debuglink(True, True)
364365
self.auto_button = True
366+
# self.auto_button = False
365367

366368
# Do not expect any specific response from device
367369
self.expected_responses = None
@@ -1189,6 +1191,7 @@ def _prepare_sign_tx(self, coin_name, inputs, outputs):
11891191
if not self.tx_api:
11901192
raise Exception('TX_API not defined')
11911193

1194+
11921195
prev_tx = self.tx_api.get_tx(binascii.hexlify(inp.prev_hash).decode('utf-8'))
11931196
txes[inp.prev_hash] = prev_tx
11941197

@@ -1199,7 +1202,6 @@ def sign_tx(self, coin_name, inputs, outputs, version=None, lock_time=None, debu
11991202

12001203
start = time.time()
12011204
txes = self._prepare_sign_tx(coin_name, inputs, outputs)
1202-
12031205
# Prepare and send initial message
12041206
tx = proto.SignTx()
12051207
tx.inputs_count = len(inputs)

keepkeylib/mapping.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from . import messages_binance_pb2 as binance_proto
99
from . import messages_tendermint_pb2 as tendermint_proto
1010
from . import messages_thorchain_pb2 as thorchain_proto
11+
from . import messages_mayachain_pb2 as mayachain_proto
1112

1213
map_type_to_class = {}
1314
map_class_to_type = {}
@@ -33,6 +34,8 @@ def build_map():
3334
msg_class = getattr(tendermint_proto, msg_name)
3435
elif msg_type.startswith('MessageType_Thorchain'):
3536
msg_class = getattr(thorchain_proto, msg_name)
37+
elif msg_type.startswith('MessageType_Mayachain'):
38+
msg_class = getattr(mayachain_proto, msg_name)
3639
else:
3740
msg_class = getattr(proto, msg_name)
3841

0 commit comments

Comments
 (0)