Proper Use of Types
Never save garbledtext in storage
Never save garbledtext in storage
garbledtext in storageGarbledtext is an intermediate random value, It's crucial to understand that these values are transient, existing only for the duration of the transaction's execution and promptly deleted once the execution is completed. Storing such a type will cause a loss of data as it has no meaning once the execution is completed.\
Don't
contract BadContract {
gtUint64 private storedGarbledText;
function setZero() public{
storedGarbledText = mpcCore.SetPublic64(0);
}
} Do
contract GoodContract {
ctUint64 private storedCipherText;
function setZero() public {
gtUint64 gtZero = mpcCore.SetPublic64(0);
storedCipherText = mpcCore.offboard(gtZero);
}
}Never Pass Ciphertext as Parameter to Another Contract or As User Input
Ciphertext as Parameter to Another Contract or As User InputSending a ciphertext from an Externally Owned Account (EOA) will fail unless it is accompanied by the correct signature to pass validation. Moreover, transmitting ciphertext between different contracts renders it invalid within the scope of the receiving contract and thus ineffective.
Don't
Do
Or
Never Return a Ciphertext to Another Contract
Ciphertext to Another ContractReturning a ciphertext for future use in a different contract is not feasible, rendering such an action pointless. However, it is logical to return such a type to an Externally Owned Account (EOA) if it was specifically designated for that particular user.
Don't : do not return system encrypted ciphertext
Do : return ciphertext to a specific user
Do : return** garbledtext **to a contract
Was this helpful?