nami icon indicating copy to clipboard operation
nami copied to clipboard

`getCollateral` returns more UTxOs than allowed by `maxCollateralInputs`, violating CIP-0030.

Open groscoe opened this issue 3 years ago • 1 comments
trafficstars

CIP-0030 defines the getCollateral method with the following proviso:

This shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only utxos). If this cannot be attained, an error message with an explanation of the blocking problem shall be returned.

At the same time, CIP-0028, which specifies the parameters introduced in the Alonzo fork, establishes a maximum number of inputs that can be used as collateral in a transaction, defined by maxCollateralInputs. This number is defined to be 3.

However, when calling getCollateral() while using a wallet with the collateral set-up in Nami (regardless of the amount parameter, which is currently ignored by Nami), I receive a list of 6 inputs:

[
    "8282582041be2107b49d531009b9899c675e9e408fbb08db69376506c0091f738082c13a028258390064a4091d5331c6bb07ae048b927a4a5530a7620f033f9e82de6482e6b50d4b35d1f7b76f4ae1cf4c232b2ce1f6f41ea93418cf50e9f6754b1a001ccfae",
    "82825820e57b66da5760f3bd412ebaa0abdc53aed56e97d3c7e2f758e1f078fa086ae25e018258390064a4091d5331c6bb07ae048b927a4a5530a7620f033f9e82de6482e6b50d4b35d1f7b76f4ae1cf4c232b2ce1f6f41ea93418cf50e9f6754b1a00115cb0",
    "82825820fe9dd7c7801ff9d59fd9d215466a067183e201bcf181c13848d08ca9c2d38bb6048258390064a4091d5331c6bb07ae048b927a4a5530a7620f033f9e82de6482e6b50d4b35d1f7b76f4ae1cf4c232b2ce1f6f41ea93418cf50e9f6754b1a00989680",
    "82825820e5ba26476fd88ff8fad0ac32369513e71ed91cfe25c1cf58e2e50cf1818f9ee3008258390064a4091d5331c6bb07ae048b927a4a5530a7620f033f9e82de6482e6b50d4b35d1f7b76f4ae1cf4c232b2ce1f6f41ea93418cf50e9f6754b1a007fb3a9",
    "82825820e20c4b30f54a947af4292369e07d6a4b4035080d62df161ddbdf532d335a78b4018258390064a4091d5331c6bb07ae048b927a4a5530a7620f033f9e82de6482e6b50d4b35d1f7b76f4ae1cf4c232b2ce1f6f41ea93418cf50e9f6754b1a0011b0de",
    "82825820d9c83079c5e1534b486d9c7e32199a1f6e1677efeeae1ff3d4195b853d5fd2df018258390064a4091d5331c6bb07ae048b927a4a5530a7620f033f9e82de6482e6b50d4b35d1f7b76f4ae1cf4c232b2ce1f6f41ea93418cf50e9f6754b1a00138846"
]

This list cannot be "the best suitable to be used as collateral inputs for transactions with plutus script inputs", since it exceeds maxCollateralInputs and cannot be attached to a transaction. Therefore, as per CIP-0030, "an error message with an explanation of the blocking problem shall be returned."

groscoe avatar Jul 13 '22 11:07 groscoe

and cannot be attached to a transaction

Just to clarify: It can be attached (we use cardano-serialization-lib) but our Tx submission fails (we use Ogmios).

klntsky avatar Jul 13 '22 12:07 klntsky