TransactionBuilder TxOutContext#1966
Conversation
…lly included in its import. Make individual variables in new struct public (may not be optimal fix). Update binding functions in libmobilecoin to use the new context based add_change_output/add_output calls to the transaction builder, and add a new "out" parameter to each of those ffi bindings so the SDK can consume the shared_secret.
…s for shared_secret in the add_change and add_ouput ffi binding functions.
TransactionBuilder add_output returns TxOutContext
iamalwaysuncomfortable
left a comment
There was a problem hiding this comment.
I believe this is too large of a change to transaction builder & that we should probably not be sending the txout shared secret in a struct. Suggested some possible alternatives, would be happy to open up the discussion more.
|
|
||
| /// Transaction output context is produced by add_output method | ||
| /// Used for receipt creation | ||
| #[allow(dead_code)] |
There was a problem hiding this comment.
Without that compilation fails due to the shared secret being dead code.
Actually it looks like making it public also fixed that. I'll remove it.
|
I think this looks good in concept -- the only thing is, I think this should be the only version of |
Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
…oinfoundation/mobilecoin into tx-builder-shared-secret
| transaction_builder.add_input(input_credentials); | ||
|
|
||
| let (_txout, _confirmation) = transaction_builder | ||
| let _tx_out_context = transaction_builder |
There was a problem hiding this comment.
| let _tx_out_context = transaction_builder | |
| transaction_builder |
| out_tx_out_confirmation_number: FfiMutPtr<McMutableBuffer>, | ||
| out_tx_out_shared_secret: FfiMutPtr<McMutableBuffer>, |
There was a problem hiding this comment.
Since we're switching TransactionBuilder::add_*output to return TxOutContext, would it make sense to similarly make these FFI add_output methods return the whole TxOutContext, replacing these 2 out pointers?
There was a problem hiding this comment.
yes, using the second out pointer was my idea, but I think returning a whole TxOutContext would be better.
There was a problem hiding this comment.
Ill work on a commit to make this change
iamalwaysuncomfortable
left a comment
There was a problem hiding this comment.
Much better, cleared by me!
|
We should merge this PR/branch into |
* add_output returns TxOutContext * Overloading modified tx builder functions for compatibility * Add TxOutContext to transaction_std lib.rs so its scope is automatically included in its import. Make individual variables in new struct public (may not be optimal fix). Update binding functions in libmobilecoin to use the new context based add_change_output/add_output calls to the transaction builder, and add a new "out" parameter to each of those ffi bindings so the SDK can consume the shared_secret. * add documentation to TxOutContext variables. Change copy out semantics for shared_secret in the add_change and add_ouput ffi binding functions. * Android Bindings TxOutContext TransactionBuilder add_output returns TxOutContext * Removing comments * Lint * Lint * Fixing test * Fixing test * Remove duplicated add_output and add_change_output * Update libmobilecoin/include/transaction.h Co-authored-by: Remoun Metyas <remoun@mobilecoin.com> * Update libmobilecoin/include/transaction.h Co-authored-by: Remoun Metyas <remoun@mobilecoin.com> * Struct deconstruction to fix build error * Fixing imports * Deconstructing more structs * Fixing syntax * Fixing tests * Remove references to old new functions * Fixing struct deconstruction * Test fix * Test fixes * Imports * Fixing test imports * Lint Co-authored-by: Alex Voloshyn <alexv@mobilecoin.com> Co-authored-by: the-real-adammork <adammork@gmail.com> Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
Motivation
This is needed for the SDKs to support Moby transaction history