Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet from seed doesn't sign transaction spending only UTXOs locked with enterprise address #216

Open
infrmtcs opened this issue Aug 28, 2023 · 1 comment

Comments

@infrmtcs
Copy link

This issue happens with wallet from seed. On signTx call, an UTXO query is made to check if any of the inputs is locked by the payment pub key hash. However, instead of querying by payment credential, the function only queries by base address (assuming that addressType is unset). Therefore the library refuses to sign the transaction even if it's a valid signer.

const utxos = await this.utxosAt(address);

Reproduce case:

84a700828258203de86f6adcecc045aa8f8f6f15ce8484cecb390fd5001b9d6c11ba1314ed0560008258209f66a1a7302491af89bdd7b9ad465cc7458e1673e8594b009b3e2489c7c242c1000182825839003cb26a37d8854084f09b27353018e3d1ed6313ef804c023f022528ab9e05ee95b33033a4b017718e77d7a1226e8092d0db9828754ff9b79a821a001215e2a1581cdfbdf85e9ed4506dbcecaa96efe600e863d41072027327be0ed11f6ba145744d454c441a00b71b00825839003cb26a37d8854084f09b27353018e3d1ed6313ef804c023f022528ab9e05ee95b33033a4b017718e77d7a1226e8092d0db9828754ff9b79a1a00479e7b021a0002b3b1031a019561310d818258209f66a1a7302491af89bdd7b9ad465cc7458e1673e8594b009b3e2489c7c242c10010825839003cb26a37d8854084f09b27353018e3d1ed6313ef804c023f022528ab9e05ee95b33033a4b017718e77d7a1226e8092d0db9828754ff9b79a1a00483db6111a00040d8aa0f5f6

Viewed by cardano-cli:

auxiliary scripts: null
certificates: null
collateral inputs:
- 9f66a1a7302491af89bdd7b9ad465cc7458e1673e8594b009b3e2489c7c242c1#0
era: Babbage
fee: 177073 Lovelace
inputs:
- 3de86f6adcecc045aa8f8f6f15ce8484cecb390fd5001b9d6c11ba1314ed0560#0
- 9f66a1a7302491af89bdd7b9ad465cc7458e1673e8594b009b3e2489c7c242c1#0
metadata: null
mint: null
outputs:
- address: addr_test1qq7ty63hmzz5pp8snvnn2vqcu0g76ccna7qycq3lqgjj32u7qhhftvesxwjtq9m33ema0gfzd6qf95xmnq582nlek7dquf3z5j
  address era: Shelley
  amount:
    lovelace: 1185250
    policy dfbdf85e9ed4506dbcecaa96efe600e863d41072027327be0ed11f6b:
      asset 744d454c44 (tMELD): 12000000
  datum: null
  network: Testnet
  payment credential key hash: 3cb26a37d8854084f09b27353018e3d1ed6313ef804c023f022528ab
  reference script: null
  stake reference:
    stake credential key hash: 9e05ee95b33033a4b017718e77d7a1226e8092d0db9828754ff9b79a
- address: addr_test1qq7ty63hmzz5pp8snvnn2vqcu0g76ccna7qycq3lqgjj32u7qhhftvesxwjtq9m33ema0gfzd6qf95xmnq582nlek7dquf3z5j
  address era: Shelley
  amount:
    lovelace: 4693627
  datum: null
  network: Testnet
  payment credential key hash: 3cb26a37d8854084f09b27353018e3d1ed6313ef804c023f022528ab
  reference script: null
  stake reference:
    stake credential key hash: 9e05ee95b33033a4b017718e77d7a1226e8092d0db9828754ff9b79a
reference inputs: []
required signers (payment key hashes needed for scripts): null
return collateral:
  address: addr_test1qq7ty63hmzz5pp8snvnn2vqcu0g76ccna7qycq3lqgjj32u7qhhftvesxwjtq9m33ema0gfzd6qf95xmnq582nlek7dquf3z5j
  address era: Shelley
  amount:
    lovelace: 4734390
  datum: null
  network: Testnet
  payment credential key hash: 3cb26a37d8854084f09b27353018e3d1ed6313ef804c023f022528ab
  reference script: null
  stake reference:
    stake credential key hash: 9e05ee95b33033a4b017718e77d7a1226e8092d0db9828754ff9b79a
total collateral: 265610
update proposal: null
validity range:
  lower bound: null
  upper bound: 26566961
withdrawals: null
witnesses: []

In this example on preview testnet, all UTXOs share the same payment credential. Because the library doesn't sign, error is thrown on transaction submission:

ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash \"3cb26a37d8854084f09b27353018e3d1ed6313ef804c023f022528ab\"])))))])
@infrmtcs
Copy link
Author

Here is my attempt to fix this: #217

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

No branches or pull requests

1 participant