Secret Contracts on Enigma Blockchain

How much size of secret contract state can be put on enclave state?
Limit on the protected memory size is 128MB. (https://01.org/sites/default/files/documentation/intel_sgx_sdk_developer_reference_for_linux_os_pdf.pdf page 5)

The limit on Linux is 4GB - https://software.intel.com/en-us/forums/intel-software-guard-extensions-intel-sgx/topic/670322

We can go past that with mmap.

But I believe gas costs and fees for accessing a contract with a huge state will be too high and prevent the creation of such contracts.

Since we are storing contract state on the public blockchain, is it fair to say only the latest state enters the enclaves for computation?

If that’s true, the 4GB limit should then apply to the latest contract states across the entire network as all nodes work on all contracts.

wait, you can mmap into SGX without that being a crazy security risk?

Seems so - https://software.intel.com/en-us/forums/intel-software-guard-extensions-intel-sgx/topic/675136

But I don’t think we’ll get there.

Well, that’s different – I believe malloc is safe much more easily than I believe mmap is safe :slight_smile:

Running a secret contract that uses 4GB memory may be too expensive, but I think more than 128MB is required when we think about interoperability between Ethereum, because DAG file for verifying PoW for Ethereum takes more than 50MB as of today. I mean, all the validators in the Enigma chain are required to be able to handle such an amount.

2 Likes