Commit 041b92b
authored
feat(storage): add validated storage with WASM-based consensus (#10)
Add per-challenge storage system where validators must reach consensus
before data is accepted. This prevents abuse by requiring WASM-defined
validation logic and cryptographic signatures on all proposals and votes.
Core implementation in distributed-storage crate:
- ValidatedStorage: main struct managing proposals, votes, and commits
- StorageWriteProposal: represents a write request with value hash
- StorageWriteVote: validator vote with optional WASM validation result
- ConsensusResult: tracks consensus state and commitment status
- WasmStorageValidator trait: interface for WASM validation logic
- DefaultWasmValidator: passthrough implementation for testing
- ValidatedStorageConfig: configurable quorum size and timeouts
WASM runtime interface integration:
- ChallengeStorage: high-level API for WASM modules to access storage
- ChallengeStorageConfig: per-challenge storage configuration
- Full async support with proposal/vote/commit lifecycle
Key features:
- Configurable quorum size for consensus requirements
- Proposal expiration with automatic cleanup
- Duplicate and conflicting vote detection
- Cryptographic hashing of values (SHA256)
- Comprehensive test coverage for all operations
Dependencies:
- Added sha2 to wasm-runtime-interface for hashing1 parent 6061a4c commit 041b92b
6 files changed
Lines changed: 1672 additions & 1 deletion
File tree
- crates
- distributed-storage/src
- wasm-runtime-interface
- src
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
132 | 140 | | |
133 | 141 | | |
134 | 142 | | |
| |||
0 commit comments