IntersectMBO / cardano-node

The core component that is used to participate in a Cardano decentralised blockchain.
https://cardano.org
Apache License 2.0
3.06k stars 721 forks source link

[BUG] - `cardano-cli transaction assemble` - not possible to assemble Tx with no signatures #3835

Closed mkoura closed 1 year ago

mkoura commented 2 years ago

Internal

Area Other

Summary It is not possible to sign/witness transaction for txin script where "type": "atLeast", "required": 0 without needing any skey.

$ cardano-cli transaction assemble --tx-body-file test_multisig_no_required_atleast_ci0_zuf_from_tx.body --out-file test_multisig_no_required_atleast_ci0_zuf_from_tx.witnessed
Missing: (--witness-file FILE)

Usage: cardano-cli transaction assemble --tx-body-file FILE
            (--witness-file FILE)
            --out-file FILE

  Assemble a tx body and witness(es) to form a transaction

Script

{
    "scripts": [
        {
            "keyHash": "df243ee05bbe556970c9f8b48088b90549b8c9e41a3380fdede62d16",
            "type": "sig"
        },
        {
            "keyHash": "452c6cc84a5430b4ff720d5692e0ce7f4d37b1f78a3bea99fdbab240",
            "type": "sig"
        },
        {
            "keyHash": "9b925a6b6462e0c7c48fc69a06d1e72d03da30655fd5af40e988140e",
            "type": "sig"
        }
    ],
    "type": "atLeast",
    "required": 0
}

See corresponding unit test for ledger - https://github.com/input-output-hk/cardano-ledger/blob/587de4528a8a65bc97bef6a5f91a19283de61580/eras/shelley-ma/test-suite/test/Test/Cardano/Ledger/Mary/Examples/MultiAssets.hs#L184-L192

Expected behavior It should be possible to send the script with no signatures for the output.

System info (please complete the following information):

CarlosLopezDeLara commented 2 years ago

@mkoura Could you clarify for us the use case of this one, please.

cc: @Jimbo4350

catch-21 commented 2 years ago

It is the same for timelocking scripts, which may be a more realistic use case. E.g. { "type": "after", "slot": 320800 } Although, that would probably still be used in combination with some signature witnesses. Even so, this isn't blocking any action, just forcing you to construct a slightly larger transaction than necessary.

Jimbo4350 commented 2 years ago

@LudvikGalois In this case we want --witness-file to also accept SimpleScripts (not plutus scripts because those are specially added to the tx in the build and build-raw commands). We can abuse the readFileScriptInAnyLang function, however we should error if the user tries to include a plutus script.