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

Abstract away the need for setting witness indexes #965

Closed
MujkicA opened this issue May 15, 2023 · 0 comments · Fixed by #1069
Closed

Abstract away the need for setting witness indexes #965

MujkicA opened this issue May 15, 2023 · 0 comments · Fixed by #1069
Assignees
Labels
enhancement New feature or request

Comments

@MujkicA
Copy link
Contributor

MujkicA commented May 15, 2023

Currently, our Input type requires you to set a witness_index. This is propagates to the methods get_asset_inputs_for_amount, add_fee_resources which is especially painful because they are defined on the Account trait. Predicates as an implementor of Account have no use for the witness_index.

witness_index is the index in the witnesses field of a transaction where the signature of the wallet that owns the input is expected to be found. It's quite tricky to avoid exposing this on a higher level as we can't ignore the order of signatures because every signer also signs over the witnesses field and thereby includes every previous signature.

@segfault-magnet mentioned the possibility of storing calls to sign_transaction as intentions which will be applied in a post-processing step, similarly to how we handle dynamic data encoding for predicates.

Another option might be to always default to idx 0 (or 1 in the case of Contract txs) and have a special interface for creating txs with multiple signatures since they are more of a niche use-case.

@MujkicA MujkicA added the enhancement New feature or request label May 15, 2023
hal3e added a commit that referenced this issue Aug 24, 2023
closes: #965

BREAKING CHANGE: 
- `send_transaction`, `dry_run`, `dry_run_no_validation` and
`estimate_transaction_cost` need ownership of the `tx`.
- removed witness index from `Input` and corresponding functions
- wallet's `sign_transaction` now accepts a `TransactionBuilder`

Co-authored-by: MujkicA <ahmedmujkic2@gmail.com>
segfault-magnet pushed a commit that referenced this issue Aug 28, 2023
closes: #965

BREAKING CHANGE: 
- `send_transaction`, `dry_run`, `dry_run_no_validation` and
`estimate_transaction_cost` need ownership of the `tx`.
- removed witness index from `Input` and corresponding functions
- wallet's `sign_transaction` now accepts a `TransactionBuilder`

Co-authored-by: MujkicA <ahmedmujkic2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants