`compile` doesn't validate keys and returns unusable descriptors
Los mantenedores suelen responder en 4 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 52/100
Línea de trabajo
Start from the compile subcommand, where the policy string is parsed as Concrete<String>, and reproduce with bdk-cli compile "pk(ABC)". The fix changes the parse type to Concrete<DescriptorPublicKey> and adds an --allow-placeholders flag that keeps the old behaviour. Done when placeholder keys and hashes are rejected by default, real keys and xpubs still compile, and existing tests and docs that use placeholders are updated.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
compile doesn't check that keys in the policy are actual keys. It succeeds and returns a descriptor that fails only later, when someone tries to use it:
$ bdk-cli compile "pk(ABC)"
{
"descriptor": "wsh(pk(ABC))#8gmtcnaw"
}
$ bitcoin-cli deriveaddresses "wsh(pk(ABC))#8gmtcnaw"
error code: -5
error message:
pk(): key 'ABC' is not valid
The policy is parsed as Concrete<String>, and a String key accepts anything.
Came up before in #225 and in the #317 review.
Proposed fix
Parse as Concrete<DescriptorPublicKey> by default. Keys are validated at parse time, so placeholders are rejected while real keys and xpubs keep working. Hashes are typed too, so sha256(H) is rejected the same way.
Keep the current behavior behind a flag, e.g. --allow-placeholders, since pk(A) style policies are handy to see what a policy compiles to, and in tests where only the policy shape matters, not the keys. This breaks existing calls with placeholders, docs and tests would need the flag or real keys.
# placeholder key is rejected
$ bdk-cli compile "pk(ABC)"
Error: Generic error: Invalid policy: unexpected «Key too short (<66 char), doesn't match any format»
# placeholder hash is rejected
$ bdk-cli compile "and(pk(02e5b88fdb71c696e1a473f309a47535b7190e21a22bd25e7fc8bd055db3bba12f),sha256(H))"
Error: Generic error: Invalid policy: unexpected «failed to parse hex»
# real keys and xpubs compile
$ bdk-cli compile "or(pk(02e5b88fdb71c696e1a473f309a47535b7190e21a22bd25e7fc8bd055db3bba12f),pk(xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8/0/*))"
{
"descriptor": "wsh(or_b(pk(02e5b88fdb71c696e1a473f309a47535b7190e21a22bd25e7fc8bd055db3bba12f),s:pk(xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8/0/*)))#t459ja6u"
}
# placeholders still work with the flag
$ bdk-cli compile "pk(ABC)" --allow-placeholders
{
"descriptor": "wsh(pk(ABC))#8gmtcnaw"
}
See
- DescriptorPublicKey in rust-miniscript
- Lenguaje dominante
- Rust
- Estrellas
- 142
- Forks
- 103
- Merge medio
- 5 d 21 h
- PR fusionados (30 d)
- 7
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de bitcoindevkit/bdk-cli
-
Remove "wallet" field from `WalletConfigInner`Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
bitcoindevkit/bdk-cli#332 · 2 comentarios ·
Los mantenedores suelen responder en 4 días
-
`warn!` output is invisible unless `RUST_LOG` is setPosiblemente ocupada @chukwudiikeh la tomó hoy. Abiertodiscussion
bitcoindevkit/bdk-cli#352 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
enhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 38/100
bitcoindevkit/bdk-cli#349 ·
Los mantenedores suelen responder en 4 días
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 50/100
bitcoindevkit/bdk-cli#340 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
Enforce Core-compatible OP_RETURN / datacarrier and standard tx-size limits in create_txPosiblemente ocupada @tvpeter la tomó hace 18 días. Abiertoenhancement
bitcoindevkit/bdk-cli#339 · 1 asignado ·
Los mantenedores suelen responder en 4 días
Todos los issues de bitcoindevkit/bdk-cli
Issues similares
-
Custom hosts written as trailing-dot FQDNs (`host.local.`) aren't detected as local backendsPosiblemente ocupada @roboomp la tomó hoy. Abiertobug prio:p2 providers triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
can1357/oh-my-pi#15798 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
requires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/datafusion-comet#7001 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Add a Storybook section to CONTRIBUTING.mdPosiblemente ocupada @ChanakyaG2004 la tomó hoy. Abiertodocumentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
FlowwStar/FlowStar#995 · 2 comentarios ·
Los mantenedores suelen responder en 1 día