test(encoding): use real addresses in test_address and cover the script-type edges
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Leggi tests/test_address.py e tests/test_encoding.py, poi esamina le funzioni a cui fanno riferimento in btc_toolkit/encoding.py per capire il comportamento attuale. Sostituisci i casi di indirizzi sintetici, aggiungi le asserzioni specificate per i casi limite e verifica che ogni test fallisca quando il comportamento coperto viene rimosso o modificato. Il lavoro è completato quando i test coprono la decodifica reale, le terminazioni degli script e il controllo della lunghezza Base58, senza modificare file in btc_toolkit/.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What
A few tests pass for the wrong reason, and a few guards have no test at all:
test_p2wshandtest_p2trintests/test_address.pyuse"bc1q" + "a" * 58and"bc1p" + "a" * 58, which have invalid checksums. They pass through the prefix-and-length guess ofdetect_address_type, not through real decoding.script_type(encoding.pyL240-L246) recognizes P2PKH by its88acending and P2SH by its87ending; nothing fails if either ending check is removed, although an address would then be derived from a script that is not P2PKH or P2SH.- The length guard in
b58check_decode(L127-L128), which stops a huge input from being decoded, is never really checked:test_base58_edge_casespasses"1" * 120but only asserts aValueError, and without the guard the checksum check raises one anyway.
What to do
- In
tests/test_address.py, replace the two synthetic addresses with real ones: a P2WSH and a P2TR address (e.g.bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3from BIP 173 andbc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0from BIP 350), and keep a separate test for the fallback guess on a checksum-invalid string. The guess gives a 62-characterbc1q/bc1paddress the same type, so these tests cannot catch broken decoding on their own: also add a real address the guess gets wrong, such asbc1zw508d6qejxtdg4y5r3zarvaryvaxxpcs(witness_v2; the guess saysunknown) orbc1pfeessrawgf(P2A). - In
tests/test_encoding.py, test that a 25-byte script with the P2PKH prefix but another ending, and a 23-byte script with the P2SH prefix but another last byte, are not P2PKH / P2SH. - Test that a Base58 string longer than 100 characters (e.g.
"1" * 101) is rejected with the message "too long" (match the message: anyValueErroris not enough).
Acceptance
- Each new or changed test fails if the code it covers is removed or changed (please say in the PR that you checked).
- No change under
btc_toolkit/.
See CONTRIBUTING.md for the test, lint and type-check commands. Comment below before starting, so two people don't take the same issue.
- Lingua principale
- Python
- Stelle
- 2
- Fork
- 1
- Merge medio
- 1h 45m
- PR unite (30g)
- 23
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di devdavidejesus/btc-toolkit
-
tests: assert which API paths each command requestsForse già presa @omarelshamy25x l’ha presa oggi. Apertagood first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
devdavidejesus/btc-toolkit#107 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
test(verify): cover invalid bits, the mainnet and testnet limits, and the strong thresholdForse già presa @omarelshamy25x l’ha presa 1 giorno fa. Apertagood first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
devdavidejesus/btc-toolkit#99 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement help wanted
Difficoltà 3/5 1-2 giorni Idoneità per principianti 71/100
devdavidejesus/btc-toolkit#105 ·
I maintainer di solito rispondono entro 1 giorno
-
api: reject a /tx response that has no txid fieldForse già presa @pkray2012 l’ha presa 1 giorno fa. Apertaenhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
devdavidejesus/btc-toolkit#103 ·
I maintainer di solito rispondono entro 1 giorno
-
cli: Ctrl+C should stop btc-toolkit without a tracebackForse già presa @jay23606 l’ha presa 1 giorno fa. Apertabug good first issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
devdavidejesus/btc-toolkit#102 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di devdavidejesus/btc-toolkit
Issue simili
-
[Resource]: SpaicelyApertaresource-submission validation-passed
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
hesreallyhim/awesome-claude-code#3875 · 1 commento ·
-
[Bug]: Ajax Pro login issueApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
bvis/aegis-hass#725 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xForse già presa @NimaVaziri l’ha presa oggi. ApertaPytorch
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NVIDIA/TensorRT-LLM#23406 ·
I maintainer di solito rispondono entro 1 giorno