Skip to content

Commit

Permalink
Improve content
Browse files Browse the repository at this point in the history
  • Loading branch information
aefhm committed Sep 7, 2023
1 parent d1bf9f1 commit b1f8e8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion docs/dapp/sapphire/guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ state encryption key from the Oasis key manager. Both the keys and values of the
items stored in state are encrypted, but the size of either is *not* hidden. You
app may need to pad state items to a constant length, or use other obfuscation.
Observers may also be able to infer computation based on storage access patterns,
so you might need to obfuscate that, too.
so you may need to obfuscate that, too. See security [chapter] for more
recommendations.

[chapter]: ./security.md#storage-access-patterns

:::danger Contract state leaks a fine-grained access pattern

Expand Down
9 changes: 6 additions & 3 deletions docs/dapp/sapphire/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ description: Security recommendations for Sapphire

# Security

Work in Progress
Work in progress to support confidential smart contract development. At the
moment we address safeguarding storage variable access patterns and provide
best practices for more secure orderings of error checking to prevent leaking
contract state.

## Storage I/O patterns
## Storage Access Patterns

You can also use a tool such as [hardhat-tracer] to examine the base EVM state
transitions under the hood.
Expand Down Expand Up @@ -36,7 +39,7 @@ npx hardhat trace --hash 0xTransactionHash
For both [gas] usage and confidentiality, non-unique data sizes are
recommended. E.g. 64-byte value will still be distinct from a 128-byte value.

:::caution Inference of Related Transactions
:::caution Inference based on access patterns

`SSTORE` keys from one transaction may be linked to `SLOAD` keys of another
transaction.
Expand Down

0 comments on commit b1f8e8c

Please sign in to comment.