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

mobilecoind: fix a bug in swap generation #3232

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

cbeck88
Copy link
Contributor

@cbeck88 cbeck88 commented Mar 13, 2023

The `SignedContingentInputBuilder` does not know the TxOut global
indices of the ring elements, they usually aren't supplied to it
unless merkle proofs of membership were supplied to it.
It usually ends up setting `tx_out_global_indices` to a list of zeroes.
Then the originator is supposed to set these correctly,
and it falls to the counterparty to find proofs of membership.

I forgot to do this in `generate_swap_impl`, so `mobilecoind` was
leaving `tx_out_global_indices` with an incorrect setting. This
commit fixes it and adds a test.

this bug was introduced a few days ago here: #3212

The `SignedContingentInputBuilder` does not know the TxOut global
indices of the ring elements, they usually aren't supplied to it
unless merkle proofs of membership were supplied to it.
It usually ends up setting `tx_out_global_indices` to a list of zeroes,
and it falls to the counterparty to find proofs of membership.

I forgot to do this in `generate_swap_impl`, so `mobilecoind` was
leaving `tx_out_global_indices` with an incorrect setting. This
commit fixes it and adds a test.
@cbeck88 cbeck88 requested review from jcape, eranrund, wjuan-mob, a team and samdealy and removed request for a team March 13, 2023 22:30
@cbeck88 cbeck88 added the ! v4.1.0 Blocker for v4.1 label Mar 13, 2023
@cbeck88 cbeck88 self-assigned this Mar 13, 2023
@cbeck88 cbeck88 added bug Something isn't working mobilecoind The MobileCoinD application labels Mar 13, 2023
.map_err(|err| Error::TxBuild(format!("build tx failed: {err}")))
.map_err(|err| Error::TxBuild(format!("build tx failed: {err}")))?;

result.tx_out_global_indices = global_indices;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to sort global_indices first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think they are supposed to correspond in order to the TxOut's in the ring

@cbeck88 cbeck88 requested a review from wjuan-mob March 13, 2023 23:28
@cbeck88 cbeck88 merged commit dae30ff into release/v4.1 Mar 14, 2023
@cbeck88 cbeck88 deleted the fix-swap-generation-in-mobilecoind branch March 14, 2023 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mobilecoind The MobileCoinD application ! v4.1.0 Blocker for v4.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants