forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce the ciphertext registry (ethereum#2)
This commit introduces the ciphertext registry, with its three main components: * protected storage space for persistent registry entries * ciphertext handles * in-memory ciphertext registry that persist for the lifetime of the transaction/call The protected storage space is implemented as a separate contract, linked to the actual one. When we create a contract, we take its address and run it through SHA256 to get the address of the corresponding protected storage contract. See more in evm.go, Create(). A ciphertext handle is the SHA256 hash of a ciphertext. It is generated by the call to the `verifyCiphertext()` precompiled contract. If a handle is stored in contract storage, we persist the actual ciphertext in protected storage, along with some metadata. One piece of metadata is the reference count. In essense, if a handle is stored in contract storage via SSTORE, the refcount is bumped by 1. If a handle is overwritten, the refcount is reduced by 1. Additionally, we automatically verify any handle that points to a ciphertext on SLOAD. Verifying a ciphertext essentially means storing it in an in-memory map from hash(ciphertext) => {ciphertext, verified_at_stack_depth}. A ciphertext is verified only for a particular stack depth and further on. On the RETURN opcode, we remove entries from the map that are no longer verified. More information to follow on that approach. More features and code cleanup will be added in future commits.
- Loading branch information
1 parent
7804a56
commit 9635d76
Showing
7 changed files
with
371 additions
and
218 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.