This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Allow off-chain indetermisim #12063
Labels
J0-enhancement
An additional feature request.
Z2-medium
Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase.
The Vision
Some users want to use contracts for number crunching (floats are banned cause of in-determinism) in off-chain situations. In these cases determinism is not required because the results are not subject to consensus.
In this case the requirement comes from the phala team who runs the contract in a secure enclave (off-chain) and wants allow users to to computation there.
The Plan
We allow for the upload of in-deterministic code blobs but prevent users from using them on-chain. Only when called off-chain (through
bare_call
with a specific flag) we allow the execution. Please note that those code blobs can never be instantiated into a contract cause that would require on-chain execution. The only way to use them is from another contract usingseal_delegate_call
. A code will be flagged in-deterministic on upload by adding a new dispatchable exactly for this reason. We don't change the existingupload_code
for backwards compatibility reasons.Original discussion: #11367
Open Questions
The text was updated successfully, but these errors were encountered: