Skip to content

Bump embit "hardened" + MaixPy; adj tests and improve ci - #973

Merged
jdlcdl merged 6 commits into
selfcustody:developfrom
jdlcdl:chore/bump-embit-psbt-fixes
Nov 14, 2026
Merged

jdlcdl merged 6 commits into
selfcustody:developfrom
jdlcdl:chore/bump-embit-psbt-fixes

Conversation

@jdlcdl

@jdlcdl jdlcdl commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

What is this PR for?

Temporarily, Krux will be using latest embit "hardened" branch:

  • currently: embit 0.8.2 + pr152 (PSBT v2) w/ hardening/fixes,see embit pr152 convo for reviews,
  • embit PR-118, PR-124, PR-82 (for embit code hygiene of tests/examples and install docs improvement) ,
  • embit PR-162, PR-169, PR-158, PR-160, PR-161, PR-167 and PR-179 for validation/hardening,
  • embit PR-181 and PR-182 for ci actions run micropython tests for future embit PRs,
  • small Krux psbt fix + tests by Odudex to integrate w/ embit pr152,
  • .github/workflows/tests.yml builds python for black using uv,
  • corrections to 6 output-descriptor test-cases with invalid checksums, caught by harshil's embit PR-161.
  • bumped MaixPy to latest cUR and k_quirc.
  • adjusted a Krux test to expect key-origin in crypto-output descriptor w/ latest cUR.

Changes made to:

  • Code
  • Tests
  • Docs
  • CHANGELOG

Did you build the code and tested on device?

  • Yes, build and tested on Amigo

What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Docs update
  • Other

@jdlcdl
jdlcdl force-pushed the chore/bump-embit-psbt-fixes branch from ed5c842 to af768f9 Compare November 10, 2026 19:13
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.60%. Comparing base (ef3b31e) to head (d04a7e3).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #973   +/-   ##
========================================
  Coverage    97.60%   97.60%           
========================================
  Files           84       84           
  Lines        10994    11001    +7     
========================================
+ Hits         10731    10738    +7     
  Misses         263      263           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jdlcdl
jdlcdl marked this pull request as ready for review November 10, 2026 19:57

@qlrd qlrd left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

utACK ec5583a. Also some nits if you wanna (EDIT: re-tACK d04a7e3)

Comment thread tests/test_psbt.py
Comment on lines +2311 to +2326
def test_sign_trim_keeps_psbt_v2(m5stickv):
"""A PSBTv2 must come back as a PSBTv2 that still derives the signed locktime"""
from embit import bip32, bip39, ec, script
from embit.bip32 import parse_path
from embit.networks import NETWORKS
from embit.psbt import PSBT, DerivationPath
from embit.transaction import Transaction, TransactionInput, TransactionOutput
from krux.key import Key, TYPE_SINGLESIG
from krux.psbt import PSBTSigner
from krux.qr import FORMAT_NONE
from krux.wallet import Wallet

mnemonic = "abandon " * 11 + "about"
root = bip32.HDKey.from_seed(
bip39.mnemonic_to_seed(mnemonic), version=NETWORKS["test"]["xprv"]
)

@qlrd qlrd Nov 12, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

DRY only: tdata.TEST_MNEMONIC in root

Suggested change
def test_sign_trim_keeps_psbt_v2(m5stickv):
"""A PSBTv2 must come back as a PSBTv2 that still derives the signed locktime"""
from embit import bip32, bip39, ec, script
from embit.bip32 import parse_path
from embit.networks import NETWORKS
from embit.psbt import PSBT, DerivationPath
from embit.transaction import Transaction, TransactionInput, TransactionOutput
from krux.key import Key, TYPE_SINGLESIG
from krux.psbt import PSBTSigner
from krux.qr import FORMAT_NONE
from krux.wallet import Wallet
mnemonic = "abandon " * 11 + "about"
root = bip32.HDKey.from_seed(
bip39.mnemonic_to_seed(mnemonic), version=NETWORKS["test"]["xprv"]
)
def test_sign_trim_keeps_psbt_v2(m5stickv, tdata):
"""A PSBTv2 must come back as a PSBTv2 that still derives the signed locktime"""
from embit import bip32, bip39, ec, script
from embit.bip32 import parse_path
from embit.networks import NETWORKS
from embit.psbt import PSBT, DerivationPath
from embit.transaction import Transaction, TransactionInput, TransactionOutput
from krux.key import Key, TYPE_SINGLESIG
from krux.psbt import PSBTSigner
from krux.qr import FORMAT_NONE
from krux.wallet import Wallet
root = bip32.HDKey.from_seed(
bip39.mnemonic_to_seed(tdata.TEST_MNEMONIC), version=NETWORKS["test"]["xprv"]
)

Comment on lines +51 to +54
def low_memory_read_from(stream, compress=CompressMode.KEEP_ALL):
if compress == CompressMode.KEEP_ALL:
raise MemoryError
return read_from(stream, compress=compress)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

honest doubt: maybe one more test w/o the mock, so a future embit bump can't silently make both parse modes disagree?

@jdlcdl
jdlcdl force-pushed the chore/bump-embit-psbt-fixes branch 2 times, most recently from 2f9daea to 4fa4c45 Compare November 13, 2026 21:32
@jdlcdl
jdlcdl marked this pull request as draft November 13, 2026 21:36
@jdlcdl
jdlcdl marked this pull request as ready for review November 13, 2026 22:57
@jdlcdl
jdlcdl requested review from odudex and qlrd November 13, 2026 22:58
@kkdao

kkdao commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

tested on a TZT.

built f51c3ab locally for maixpy_tzt: it builds, and firmware.bin is 1,635,008 bytes, 16,320 more than the 26.09.0 release.

the board test used this tree plus MaixPy#60 and the qr.py change from odudex's bump-cUR-and-k_quirc branch, compared with 26.09.0 on the same board. loading a mnemonic by SeedQR, and signing a 1 input and a 50 input p2wpkh PSBT scanned as animated UR QR, work on both.

i also ran embit's own tests on d8b18e2, because the hardened branch has no CI run of its own: pytest on Python 3.12 gives 441 passed and 22 skipped (no C secp256k1 or Liquid library on this machine), and tools/micropython_tests.sh gives 136 tests OK.

one thing to know before the release: the Build workflow is disabled on GitHub right now, so merging this builds no firmware for the other boards.

@jdlcdl
jdlcdl force-pushed the chore/bump-embit-psbt-fixes branch from f51c3ab to 3e34a96 Compare November 14, 2026 13:46
@jdlcdl jdlcdl changed the title Chore/bump embit psbt fixes Bump embit "hardened" + MaixPy; adj tests and improve ci Nov 14, 2026
odudex and others added 6 commits November 14, 2026 14:35
Duplicate keys are now rejected in compressed mode too, so force the SD card
fallback with a MemoryError instead. A witness_utxo contradicting the previous
tx is now refused by verify(), so test the rejection in both parse modes.
Trimming rebuilt a v0 PSBT, dropping the version, locktime fields and the
TX_MODIFIABLE flags updated by the signer.
Embit now parses them, and Krux only refused them through a TypeError.
chore: ci action: black installs python via uv.
test: fixes 6 invalid bip380 descriptor checksum testcases; ty harshil for embit PR-161
chore: bump embit to "hardened"; master at 2b375a3 + following:
PR-152, PR-118, PR-124, PR-162, PR-82, PR-181, PR-182,
PR-169, PR-158, PR-160, PR-161, PR-167, and PR-179
@jdlcdl
jdlcdl force-pushed the chore/bump-embit-psbt-fixes branch from c5d2e52 to d04a7e3 Compare November 14, 2026 14:44
@jdlcdl
jdlcdl merged commit 9092846 into selfcustody:develop Nov 14, 2026
12 checks passed
@jdlcdl
jdlcdl deleted the chore/bump-embit-psbt-fixes branch November 14, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants