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

Function selectionAndEvaluation called on TxBuilder.complete assumes paymentKey - won't work for multisignature or SC wallets #361

Open
zachyking opened this issue Oct 11, 2024 · 1 comment

Comments

@zachyking
Copy link

I migrated multisig service from Lucid to Lucid Evolution and was facing this issue.

selectionAndEvalution first looks for collateral even if only scripts are Native not Plutus, that's one issue.

Than here inside a loop, we assume payment_key().
https://github.com/Anastasia-Labs/lucid-evolution/blob/50ae067137d7acfb1c84baedfc27f4f9a0e27261/packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts#L178C5-L187C6

if (_Array.isNonEmptyArray(inputsToAdd)) {
      for (const utxo of inputsToAdd) {
        const input = CML.SingleInputBuilder.from_transaction_unspent_output(
          utxoToCore(utxo),
        ).payment_key();
        config.txBuilder.add_input(input);
      }
      config.collectedInputs = [...config.collectedInputs, ...inputsToAdd];
      estimatedFee = yield* estimateFee(config, script_calculation);
}

We can just call collectFromUTxO(config, inputsToAdd)(); instead, which already handles different types of inputs.

I am not sure about two things

  • we need some other way of specifying and handling collateral for smart contract wallets
  • collectFromUTxO takes a redeemer when necessary, so I am not sure if there's already code handling that
export const collectFromUTxO =
 (
   config: TxBuilder.TxBuilderConfig,
   utxos: UTxO[],
   collectInputs: Boolean = true,
 ) =>
 (redeemer?: Redeemer): Effect.Effect<void, TxBuilderError> 
@zachyking
Copy link
Author

I created #362 as a draft

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