-
Notifications
You must be signed in to change notification settings - Fork 151
confidential asset types #1438
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
confidential asset types #1438
Conversation
|
As a general comment, the the I dunno, I feel like this should be represented as: And just use the token ID when serializing/deserializing. I realize our uses are more complex than that, but I worry that we're opening the door to a lot of type confusion bugs by not letting the compiler enforce this kind of thing wherever possible. |
One of the design requirements is, if we ship this functionality, it should be possible to stand up new token ids in prod without signing a new enclave. If we make AmountData a template over the token id as you describe, then there is no way the enclave can create fee outputs for tokens that didn't exist when it was signed, because those types were not part of the build at that time. So this proposal is incompatible with the requirements. Let me know if you still have questions about this, or if you see some alternative. |
I think actually, the best mechanism we have for catching those bugs is the proof of opening, which is checked both by the signer after they construct the Tx, and by the consensus verifier. Even if there is a bug or a weak API in the TransactionBuilder where tokens of different types get mixed up, building the transaction will fail because they will be unable to create a valid proof of opening. |
eaf88d2 to
ac1bdca
Compare
|
On the topic of breaking changes, I am wondering what the plan is for getting this deployed. If we deploy this to the network before SDKs upgrade, then they will no longer be able to submit transactions. It would be nice if we could somehow make the
|
|
I don't know right now how we can make this not breaking. If we allow people to omit proof of opening, then they could mix token ids. So once we start having multiple token ids, the old transaction types are not valid. We could maybe like, duplicate the transaction-core crate and have a I think it would be simpler to make the clients figure out based on the MRENCLAVE they get during attestation whether to use the v1 transaction builder or the v2 transaction builder |
|
We could try to make the enclave depend on two different revisions of transaction core, that might avoid actually copy pasting all the code. But it's still going to be very complicated. |
|
That does mean that we need to figure out how to expose two versions of the TransactionBuilder for the SDKs. |
|
@eranrund they might be able to just link an old and new version of libmobilecoin? |
|
maybe there is a better way, maybe we can accept the old Txs as long as all the inputs and outputs are missing the masked_token_id, and then skip the proof of opening. |
|
and then in a future revision, we require the masked token id and proof of opening? that might be a better direction for this PR, gonna think on it some more thanks for asking good questions you guys |
b589066 to
84009a4
Compare
I would be surprised, due to symbol name collision. Might be able to do some horrible linker tricks to get around it but I am not excited about that... I also have no idea how the Java JNI stuff would behave. |
|
Thanks, @garbageslam, this looks very good. I also appreciate the extra care to update the transaction crate's doc comments. |
77015d1 to
3cbdf55
Compare
|
This has passed deploy (build network #46), I think we should merge it if there are no outstanding issues. I didn't get the bootstrap with custom token ids to work, that seems to break deployment and I'm not sure why. But I think we can test that functionality end to end once minting is merged. |
eranrund
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for all your hard work on this.
I would prefer if this one gets more than two approvals before merging, preferably two more approvals from people intimately familiar with the codebase.
| let amount: Amount = | ||
| Amount::new(value, &shared_secret).expect("could not create amount object"); | ||
| matches = amount.get_value(&shared_secret).is_ok() | ||
| if let Ok(_public_key) = RistrettoPublic::try_from_ffi(&tx_out_public_key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If its not called can we remove it? Having incorrect code is worse than having a breaking build in my opinion.
| } | ||
| } | ||
|
|
||
| impl PartialEq<u32> for TokenId { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
|
Thank you for all of your work on this, Chris! |
4519c49 to
3bc7be3
Compare
sugargoat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome - thanks for the great work and prototype. Will make sure the MCIP is up to date with this as well!
This PR implements the transaction math part of confidential token ids.
MCIP (still draft) is here: mobilecoinfoundation/mcips#25
Still TODO:
More TODO