sui icon indicating copy to clipboard operation
sui copied to clipboard

crypto: add intent signing struct

Open joyqvq opened this issue 3 years ago • 4 comments

a rework of https://github.com/MystenLabs/sui/pull/2116/files with https://github.com/bmwill/sui/commit/f5b8026a436eeff3fa0c7f61f369ede1b8683a1f?diff=unified

joyqvq avatar Aug 01 '22 20:08 joyqvq

Thanks @joyqvq for resurrecting this. I think that before we look at getting this merged that we should revisit some parts of the intent scheme since I believe they should actually be rolled into some of our core structures. Specifically we need to add a chain_id to all transactions and for forward-compatibility reasons we may want to augment the serialized format of our core data structures, essentially baking in a part of the "intent" (the name of the struct) into the actual serialized payload of an object.

bmwill avatar Aug 01 '22 22:08 bmwill

Thanks @joyqvq for resurrecting this. I think that before we look at getting this merged that we should revisit some parts of the intent scheme since I believe they should actually be rolled into some of our core structures. Specifically we need to add a chain_id to all transactions and for forward-compatibility reasons we may want to augment the serialized format of our core data structures, essentially baking in a part of the "intent" (the name of the struct) into the actual serialized payload of an object.

add a chain_id to all transactions by transaction you mean struct TransactionEnvelope?

joyqvq avatar Aug 02 '22 01:08 joyqvq

Specifically to TransactionData

bmwill avatar Aug 02 '22 04:08 bmwill

Specifically to TransactionData

talked to @kchalkias offline, we decide that we do NOT want to include chain id in the transaction data bc we assume object id are guaranteed to be unique and collision resistant as they are derived from the chain id from genesis.

instead, we will have user sign over IntentMessage - this will be a breaking change that we park till after private testnet stabilizes.

joyqvq avatar Aug 17 '22 19:08 joyqvq

💳 Wallet Extension has been built, you can download the packaged extension here: https://github.com/MystenLabs/sui/actions/runs/3205505034#artifacts

github-actions[bot] avatar Oct 05 '22 20:10 github-actions[bot]

We may end up needing to do something slightly different with ChainId (as this is something that we probably want to exist onchain in some capacity) but we can iterate on that later

bmwill avatar Oct 07 '22 18:10 bmwill

We may end up needing to do something slightly different with ChainId (as this is something that we probably want to exist onchain in some capacity) but we can iterate on that later

Good point, I have been trying this out in a draft PR. I think this could live in AuthorityState and also expose a get_chain_id endpoint that client software can query for. User can select network/chain_id in wallet for signing.

Going to land this one for now, (since no methods is actually using intent), and iterate on the followup PRs.

joyqvq avatar Oct 07 '22 18:10 joyqvq