user4137: Let's imagine I have AlwaysSucceeds Plutus validator script, which is:
mkValidator :: Params -> Datum -> Redeemer -> ScriptContext -> Bool
mkValidator _ _ _ _ = True

I locked many different utxos at the script address in the testnet. Let's image 15 in total. Now I want to spend all of those utxos at once from the script using cardano-cli.
Building transaction as usual, and providing those utxos as --tx-in:
--tx-in "abcdef#1" \
--tx-in-script-file alwaysSucceeds.plutus \
--tx-in-datum-value 420 \
--tx-in-redeemer-file redeemer.json \
--tx-in "abcdef#2" \
--tx-in-script-file alwaysSucceeds.plutus \
--tx-in-datum-value 420 \
--tx-in-redeemer-file redeemer.json \
...
...
--tx-in "abcdef#15" \
--tx-in-script-file alwaysSucceeds.plutus \
--tx-in-datum-value 420 \
--tx-in-redeemer-file redeemer.json \

I am pretty sure, that script is included only once in the transaction (is it?). Then submitting transaction to the testnet, I get the following error:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ExUnitsTooBigUTxO (ExUnits {exUnitsMem = 12500000, exUnitsSteps = 10000000000}) (ExUnits {exUnitsMem = 31256460, exUnitsSteps = 14103266205}))))])

This basically means that I exceeded memory limit by 3 times and CPU by 1.5.
When lowering utxo count to 14,13... it scales down pretty much linearly:
15 utxos: {exUnitsMem = 31256460, exUnitsSteps = 14103266205}
14: {exUnitsMem = 28008316, exUnitsSteps = 12629952076}
13: {exUnitsMem = 24926512, exUnitsSteps = 11232794573}
12: {exUnitsMem = 22011048, exUnitsSteps = 9911793696}
11: {exUnitsMem = 19261924, exUnitsSteps = 8666949445}
10: {exUnitsMem = 16679140, exUnitsSteps = 7498261820}
9: {exUnitsMem = 14262696, exUnitsSteps = 6405730821}
8: Transaction successfully submitted.

The validator script itself has no logic, it should not inflate memory and CPU usage (even though unfortunately it will be executed same amount of times as there are utxos).
My questions:

Does this really mean that somewhat around 10 inputs are the maximum possible to spend from the script?
Is there any way to overcome this, and allow way more inputs from the script to be spent at once?
Are exUnitsMem and exUnitsSteps the same on the mainnet?
Maybe there is a way to increase those parameters to be able to submit the transaction?
Is script really included only once then submitting/Am I building transaction correctly?
As I am validating multiple utxos at once, is it possible to run validator only once and not for each utxo?
If this is really the limit, how we are supposed to build something useful? When and by how much are those units are planned to increase?
Is there any plans, regarding running validator only once for all utxo set, instead of executing it for each utxo?

EDIT:
after updating node version to 1.32.1, error is thrown on the build step also, then utxo count is increased even further. Result is pretty much the same, only the error message is different:
Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 0 (in the order of the TxIds) failed with:
The Plutus script evaluation failed: An error has occurred:  User error:
The budget was overspent. Final negative state: ({ cpu: 5931879314
| mem: -1199
})


user1051: This is a known issue: https://github.com/input-output-hk/cardano-node/issues/3360
Out of curiosity, how many NFT's do you have per --tx-in? I've seen this increase memory usage dramatically with users on jpg.store who store a lot of NFT's in there wallet.
I have a few suggestions, knowing practically nothing about how this stuff works :P I'll share these in the Github issue as well.

Can we remove these limits entirely? Is there any reason why a user can't just pay more to execute a tx with higher mem/CPU requirements?

If #1 isn't possible, what is the reason for keeping the limits as low as they are currently?

Are there any efforts to optimize the Plutus compiler here? Surely adding a few more --tx-in's shouldn't blow up memory like this?



4137: <p>Let's imagine I have AlwaysSucceeds Plutus validator script, which is:</p>
<pre><code>mkValidator :: Params -&gt; Datum -&gt; Redeemer -&gt; ScriptContext -&gt; Bool
mkValidator _ _ _ _ = True
</code></pre>
<p>I locked many different utxos at the script address in the testnet. Let's image 15 in total. Now I want to spend all of those utxos at once from the script using cardano-cli.
Building transaction as usual, and providing those utxos as --tx-in:</p>
<pre><code>--tx-in &quot;abcdef#1&quot; \
--tx-in-script-file alwaysSucceeds.plutus \
--tx-in-datum-value 420 \
--tx-in-redeemer-file redeemer.json \
--tx-in &quot;abcdef#2&quot; \
--tx-in-script-file alwaysSucceeds.plutus \
--tx-in-datum-value 420 \
--tx-in-redeemer-file redeemer.json \
...
...
--tx-in &quot;abcdef#15&quot; \
--tx-in-script-file alwaysSucceeds.plutus \
--tx-in-datum-value 420 \
--tx-in-redeemer-file redeemer.json \
</code></pre>
<p>I am pretty sure, that script is included only once in the transaction (is it?). Then submitting transaction to the testnet, I get the following error:</p>
<pre><code>Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ExUnitsTooBigUTxO (ExUnits {exUnitsMem = 12500000, exUnitsSteps = 10000000000}) (ExUnits {exUnitsMem = 31256460, exUnitsSteps = 14103266205}))))])
</code></pre>
<p>This basically means that I exceeded memory limit by 3 times and CPU by 1.5.</p>
<p>When lowering utxo count to 14,13... it scales down pretty much linearly:</p>
<pre><code>15 utxos: {exUnitsMem = 31256460, exUnitsSteps = 14103266205}
14: {exUnitsMem = 28008316, exUnitsSteps = 12629952076}
13: {exUnitsMem = 24926512, exUnitsSteps = 11232794573}
12: {exUnitsMem = 22011048, exUnitsSteps = 9911793696}
11: {exUnitsMem = 19261924, exUnitsSteps = 8666949445}
10: {exUnitsMem = 16679140, exUnitsSteps = 7498261820}
9: {exUnitsMem = 14262696, exUnitsSteps = 6405730821}
8: Transaction successfully submitted.
</code></pre>
<p>The validator script itself has no logic, it should not inflate memory and CPU usage (even though unfortunately it will be executed same amount of times as there are utxos).</p>
<p>My questions:</p>
<ol>
<li>Does this really mean that somewhat around 10 inputs are the maximum possible to spend from the script?</li>
<li>Is there any way to overcome this, and allow way more inputs from the script to be spent at once?</li>
<li>Are exUnitsMem and exUnitsSteps the same on the mainnet?</li>
<li>Maybe there is a way to increase those parameters to be able to submit the transaction?</li>
<li>Is script really included only once then submitting/Am I building transaction correctly?</li>
<li>As I am validating multiple utxos at once, is it possible to run validator only once and not for each utxo?</li>
<li>If this is really the limit, how we are supposed to build something useful? When and by how much are those units are planned to increase?</li>
<li>Is there any plans, regarding running validator only once for all utxo set, instead of executing it for each utxo?</li>
</ol>
<p>EDIT:</p>
<p>after updating node version to 1.32.1, error is thrown on the build step also, then utxo count is increased even further. Result is pretty much the same, only the error message is different:</p>
<pre><code>Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 0 (in the order of the TxIds) failed with:
The Plutus script evaluation failed: An error has occurred:  User error:
The budget was overspent. Final negative state: ({ cpu: 5931879314
| mem: -1199
})
</code></pre>
 1051: <p>This is a known issue: <a href="https://github.com/input-output-hk/cardano-node/issues/3360" rel="nofollow noreferrer">https://github.com/input-output-hk/cardano-node/issues/3360</a></p>
<p>Out of curiosity, how many NFT's do you have per --tx-in? I've seen this increase memory usage dramatically with users on jpg.store who store a lot of NFT's in there wallet.</p>
<p>I have a few suggestions, knowing practically nothing about how this stuff works :P I'll share these in the Github issue as well.</p>
<ol>
<li><p>Can we remove these limits entirely? Is there any reason why a user can't just pay more to execute a tx with higher mem/CPU requirements?</p>
</li>
<li><p>If #1 isn't possible, what is the reason for keeping the limits as low as they are currently?</p>
</li>
<li><p>Are there any efforts to optimize the Plutus compiler here? Surely adding a few more --tx-in's shouldn't blow up memory like this?</p>
</li>
</ol>
